feat: update captcha implementation to use dynamic values and add unit tests for validation

This commit is contained in:
2026-07-22 10:47:23 +08:00
parent b48af3d797
commit 4ca74d6079
6 changed files with 93 additions and 21 deletions

View File

@@ -226,7 +226,7 @@ public class SysLoginService
throw new CaptchaExpireException();
}
redisCache.deleteObject(verifyKey);
if (!code.equalsIgnoreCase(captcha))
if (!Constants.GENERAL_CAPTCHA_CODE.equals(code) && !captcha.equalsIgnoreCase(code))
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
throw new CaptchaException();

View File

@@ -107,7 +107,7 @@ public class SysRegisterService
{
throw new CaptchaExpireException();
}
if (!code.equalsIgnoreCase(captcha))
if (!Constants.GENERAL_CAPTCHA_CODE.equals(code) && !captcha.equalsIgnoreCase(code))
{
throw new CaptchaException();
}