Fix 验证码错误是用户名称不能被存下来
This commit is contained in:
1 parent
160814777d
commit
494f279739
1 file changed
+4
-2
@@ -54,6 +54,7 @@ func IdentityHandler(c *gin.Context) interface{} {
|
|||||||
func Authenticator(c *gin.Context) (interface{}, error) {
|
func Authenticator(c *gin.Context) (interface{}, error) {
|
||||||
var loginVals Login
|
var loginVals Login
|
||||||
var loginlog LoginLog
|
var loginlog LoginLog
|
||||||
|
|
||||||
ua := user_agent.New(c.Request.UserAgent())
|
ua := user_agent.New(c.Request.UserAgent())
|
||||||
loginlog.Ipaddr = c.ClientIP()
|
loginlog.Ipaddr = c.ClientIP()
|
||||||
location := utils.GetLocation(c.ClientIP())
|
location := utils.GetLocation(c.ClientIP())
|
||||||
@@ -68,13 +69,15 @@ func Authenticator(c *gin.Context) (interface{}, error) {
|
|||||||
loginlog.Os = ua.OS()
|
loginlog.Os = ua.OS()
|
||||||
loginlog.Msg = "登录成功"
|
loginlog.Msg = "登录成功"
|
||||||
loginlog.Platform = ua.Platform()
|
loginlog.Platform = ua.Platform()
|
||||||
|
|
||||||
if err := c.ShouldBind(&loginVals); err != nil {
|
if err := c.ShouldBind(&loginVals); err != nil {
|
||||||
loginlog.Status = "1"
|
loginlog.Status = "1"
|
||||||
loginlog.UserName = loginVals.Username
|
|
||||||
loginlog.Msg = "数据解析失败"
|
loginlog.Msg = "数据解析失败"
|
||||||
|
loginlog.UserName = loginVals.Username
|
||||||
loginlog.Create()
|
loginlog.Create()
|
||||||
return nil, jwt.ErrMissingLoginValues
|
return nil, jwt.ErrMissingLoginValues
|
||||||
}
|
}
|
||||||
|
loginlog.UserName = loginVals.Username
|
||||||
if !store.Verify(loginVals.UUID, loginVals.Code, true) {
|
if !store.Verify(loginVals.UUID, loginVals.Code, true) {
|
||||||
loginlog.Status = "1"
|
loginlog.Status = "1"
|
||||||
loginlog.Msg = "验证码错误"
|
loginlog.Msg = "验证码错误"
|
||||||
@@ -83,7 +86,6 @@ func Authenticator(c *gin.Context) (interface{}, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
user, role, e := loginVals.GetUser()
|
user, role, e := loginVals.GetUser()
|
||||||
loginlog.UserName = loginVals.Username
|
|
||||||
if e == nil {
|
if e == nil {
|
||||||
loginlog.Create()
|
loginlog.Create()
|
||||||
return map[string]interface{}{"user": user, "role": role}, nil
|
return map[string]interface{}{"user": user, "role": role}, nil
|
||||||
|
|||||||
Reference in new issue
Block a user