diff --git a/kernel-d-validator/validator-api/src/main/java/cn/stylefeng/roses/kernel/validator/constants/CaptchaConstants.java b/kernel-d-validator/validator-api/src/main/java/cn/stylefeng/roses/kernel/validator/constants/CaptchaConstants.java index 0fe5f7252..d6d19c1d8 100644 --- a/kernel-d-validator/validator-api/src/main/java/cn/stylefeng/roses/kernel/validator/constants/CaptchaConstants.java +++ b/kernel-d-validator/validator-api/src/main/java/cn/stylefeng/roses/kernel/validator/constants/CaptchaConstants.java @@ -11,6 +11,6 @@ public interface CaptchaConstants { /** * 验证码 缓存前缀标识 */ - String CAPTCHA_CACHE_KEY_PREFIX = "KAPTCHA_KEY"; + String CAPTCHA_CACHE_KEY_PREFIX = "CAPTCHA_KEY"; } diff --git a/kernel-d-validator/validator-api/src/main/java/cn/stylefeng/roses/kernel/validator/exception/CountValidateException.java b/kernel-d-validator/validator-api/src/main/java/cn/stylefeng/roses/kernel/validator/exception/CountValidateException.java index ad1dfafdb..05be08d77 100644 --- a/kernel-d-validator/validator-api/src/main/java/cn/stylefeng/roses/kernel/validator/exception/CountValidateException.java +++ b/kernel-d-validator/validator-api/src/main/java/cn/stylefeng/roses/kernel/validator/exception/CountValidateException.java @@ -1,5 +1,6 @@ package cn.stylefeng.roses.kernel.validator.exception; +import cn.hutool.core.util.StrUtil; import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum; import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException; import cn.stylefeng.roses.kernel.validator.constants.ValidatorConstants; @@ -12,8 +13,8 @@ import cn.stylefeng.roses.kernel.validator.constants.ValidatorConstants; */ public class CountValidateException extends ServiceException { - public CountValidateException(AbstractExceptionEnum exception, String userTip) { - super(ValidatorConstants.VALIDATOR_MODULE_NAME, exception.getErrorCode(), userTip); + public CountValidateException(AbstractExceptionEnum exception, Object... params) { + super(ValidatorConstants.VALIDATOR_MODULE_NAME, exception.getErrorCode(), StrUtil.format(exception.getUserTip(), params)); } public CountValidateException(AbstractExceptionEnum exception) { diff --git a/kernel-d-validator/validator-sdk-captcha/src/main/java/cn/stylefeng/roses/kemel/captcha/CaptchaService.java b/kernel-d-validator/validator-sdk-captcha/src/main/java/cn/stylefeng/roses/kemel/captcha/CaptchaService.java index 8f67a2828..f67f32cb5 100644 --- a/kernel-d-validator/validator-sdk-captcha/src/main/java/cn/stylefeng/roses/kemel/captcha/CaptchaService.java +++ b/kernel-d-validator/validator-sdk-captcha/src/main/java/cn/stylefeng/roses/kemel/captcha/CaptchaService.java @@ -35,11 +35,14 @@ public class CaptchaService implements CaptchaApi { if (StrUtil.isAllEmpty(verKey, verCode)) { return false; } + if (!verCode.trim().toLowerCase().equals(cacheOperatorApi.get(verKey))) { return false; } + //删除缓存中验证码 cacheOperatorApi.remove(verKey); + return true; }