作者 陈志颖

fix:开放密码校验接口

... ... @@ -15,7 +15,9 @@ func CheckJWTToken(ctx *context.Context) {
var (
msg *protocol.ResponseMessage
)
token := ctx.Input.Header("x-mmm-accesstoken")
if strings.HasSuffix(ctx.Request.RequestURI, "login") ||
strings.HasSuffix(ctx.Request.RequestURI, "accessToken") ||
strings.HasSuffix(ctx.Request.RequestURI, "refreshToken") ||
... ... @@ -29,11 +31,13 @@ func CheckJWTToken(ctx *context.Context) {
strings.HasSuffix(ctx.Request.RequestURI, "changePassword") {
return
}
defer func() {
if msg != nil {
ctx.Output.JSON(msg, false, false)
}
}()
if u, err := utils.ParseJWTToken(token); err != nil {
msg = protocol.NewMesage(4141)
return
... ...
... ... @@ -6,9 +6,10 @@ import (
)
func init() {
beego.Router("/auth/checkPassword", &controllers.AuthController{}, "Post:CheckPassword")
nsV1 := beego.NewNamespace("v1") //, beego.NSBefore(middleware.CheckJWTToken)
nsV1.Router("/auth/login", &controllers.AuthController{}, "Post:Login")
nsV1.Router("/auth/checkPassword", &controllers.AuthController{}, "Post:CheckPassword") // 校验密码
//nsV1.Router("/auth/checkPassword", &controllers.AuthController{}, "Post:CheckPassword") // 校验密码
nsV1.Router("/auth/smsCode", &controllers.AuthController{}, "Post:SmsCode")
nsV1.Router("/auth/accessToken", &controllers.AuthController{}, "Post:AccessToken")
nsV1.Router("/auth/refreshToken", &controllers.AuthController{}, "Post:RefreshToken")
... ...