mirror of https://gitee.com/xiaonuobase/snowy
【更新】验证码校验逻辑
【更新】验证码校验逻辑 Signed-off-by: bubu <8096927+bubu-space@user.noreply.gitee.com>pull/254/head
parent
6414fd7a91
commit
d2fa05a8a3
|
@ -149,16 +149,16 @@ public class AuthServiceImpl implements AuthService {
|
||||||
if(ObjectUtil.isEmpty(existValidCode)) {
|
if(ObjectUtil.isEmpty(existValidCode)) {
|
||||||
throw new CommonException(AuthExceptionEnum.VALID_CODE_ERROR.getValue());
|
throw new CommonException(AuthExceptionEnum.VALID_CODE_ERROR.getValue());
|
||||||
}
|
}
|
||||||
// 移除该验证码
|
// 不一致则直接验证码错误
|
||||||
|
if (!validCode.equalsIgnoreCase(Convert.toStr(existValidCode))) {
|
||||||
|
throw new CommonException("验证码错误");
|
||||||
|
}
|
||||||
|
// 验证成功移除该验证码
|
||||||
if(ObjectUtil.isEmpty(phoneOrEmail)) {
|
if(ObjectUtil.isEmpty(phoneOrEmail)) {
|
||||||
commonCacheOperator.remove(AUTH_VALID_CODE_CACHE_KEY + validCodeReqNo);
|
commonCacheOperator.remove(AUTH_VALID_CODE_CACHE_KEY + validCodeReqNo);
|
||||||
} else {
|
} else {
|
||||||
commonCacheOperator.remove(AUTH_VALID_CODE_CACHE_KEY + phoneOrEmail + StrUtil.UNDERLINE + validCodeReqNo);
|
commonCacheOperator.remove(AUTH_VALID_CODE_CACHE_KEY + phoneOrEmail + StrUtil.UNDERLINE + validCodeReqNo);
|
||||||
}
|
}
|
||||||
// 不一致则直接验证码错误
|
|
||||||
if (!validCode.equalsIgnoreCase(Convert.toStr(existValidCode))) {
|
|
||||||
throw new CommonException("验证码错误");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue