mirror of https://gitee.com/stylefeng/roses
【validator】整理validator模块
parent
576fa5aeb7
commit
f57362b724
|
@ -11,6 +11,6 @@ public interface CaptchaConstants {
|
|||
/**
|
||||
* 验证码 缓存前缀标识
|
||||
*/
|
||||
String CAPTCHA_CACHE_KEY_PREFIX = "KAPTCHA_KEY";
|
||||
String CAPTCHA_CACHE_KEY_PREFIX = "CAPTCHA_KEY";
|
||||
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue