|
|
|
@ -11,7 +11,7 @@ import (
|
|
|
|
|
|
|
|
|
|
func JWTAuth() gin.HandlerFunc {
|
|
|
|
|
return func(c *gin.Context) {
|
|
|
|
|
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), "")
|
|
|
|
|
ok, userID, errInfo := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), "")
|
|
|
|
|
log.NewInfo("0", utils.GetSelfFuncName(), "userID: ", userID)
|
|
|
|
|
c.Set("userID", userID)
|
|
|
|
|
if !ok {
|
|
|
|
@ -19,6 +19,8 @@ func JWTAuth() gin.HandlerFunc {
|
|
|
|
|
c.Abort()
|
|
|
|
|
http.RespHttp200(c, constant.ErrParseToken, nil)
|
|
|
|
|
return
|
|
|
|
|
} else {
|
|
|
|
|
log.NewInfo("0", utils.GetSelfFuncName(), "failed: ", errInfo)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|