Skip to content

Commit

Permalink
fix captcha
Browse files Browse the repository at this point in the history
  • Loading branch information
lejianwen committed Dec 18, 2024
1 parent bba1026 commit 09fdd34
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions http/controller/admin/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,7 @@ func (ct *Login) Login(c *gin.Context) {

// 检查是否需要验证码
if loginLimiter.NeedsCaptcha(clientIp) {
if f.Captcha == "" {
response.Fail(c, 110, response.TranslateMsg(c, "CaptchaError"))
return
}
if !loginLimiter.VerifyCaptcha(clientIp, f.Captcha) {
if f.Captcha == "" || !loginLimiter.VerifyCaptcha(clientIp, f.Captcha) {
response.Fail(c, 101, response.TranslateMsg(c, "CaptchaError"))
return
}
Expand Down

0 comments on commit 09fdd34

Please sign in to comment.