@@ -47,30 +47,30 @@ func (b *BaseApi) Login(c *gin.Context) {
47
47
}
48
48
49
49
var oc bool = openCaptcha == 0 || openCaptcha < interfaceToInt (v )
50
+ if oc && ! store .Verify (l .CaptchaId , l .Captcha , true ) {
51
+ // 验证码次数+1
52
+ global .BlackCache .Increment (key , 1 )
53
+ response .FailWithMessage ("验证码错误" , c )
54
+ return
55
+ }
50
56
51
- if ! oc || store .Verify (l .CaptchaId , l .Captcha , true ) {
52
- u := & system.SysUser {Username : l .Username , Password : l .Password }
53
- user , err := userService .Login (u )
54
- if err != nil {
55
- global .GVA_LOG .Error ("登陆失败! 用户名不存在或者密码错误!" , zap .Error (err ))
56
- // 验证码次数+1
57
- global .BlackCache .Increment (key , 1 )
58
- response .FailWithMessage ("用户名不存在或者密码错误" , c )
59
- return
60
- }
61
- if user .Enable != 1 {
62
- global .GVA_LOG .Error ("登陆失败! 用户被禁止登录!" )
63
- // 验证码次数+1
64
- global .BlackCache .Increment (key , 1 )
65
- response .FailWithMessage ("用户被禁止登录" , c )
66
- return
67
- }
68
- b .TokenNext (c , * user )
57
+ u := & system.SysUser {Username : l .Username , Password : l .Password }
58
+ user , err := userService .Login (u )
59
+ if err != nil {
60
+ global .GVA_LOG .Error ("登陆失败! 用户名不存在或者密码错误!" , zap .Error (err ))
61
+ // 验证码次数+1
62
+ global .BlackCache .Increment (key , 1 )
63
+ response .FailWithMessage ("用户名不存在或者密码错误" , c )
64
+ return
65
+ }
66
+ if user .Enable != 1 {
67
+ global .GVA_LOG .Error ("登陆失败! 用户被禁止登录!" )
68
+ // 验证码次数+1
69
+ global .BlackCache .Increment (key , 1 )
70
+ response .FailWithMessage ("用户被禁止登录" , c )
69
71
return
70
72
}
71
- // 验证码次数+1
72
- global .BlackCache .Increment (key , 1 )
73
- response .FailWithMessage ("验证码错误" , c )
73
+ b .TokenNext (c , * user )
74
74
}
75
75
76
76
// TokenNext 登录以后签发jwt
0 commit comments