fix captcha

This commit is contained in:
lejianwen
2024-12-18 13:51:06 +08:00
parent 1e15287c83
commit e36d307d28

View File

@@ -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
}