【更新】验证码校验成功后再从redis移除

【更新】验证码校验成功后再从redis移除

Signed-off-by: bubu <8096927+bubu-space@user.noreply.gitee.com>
pull/261/head
bubu 2025-05-17 03:29:14 +00:00 committed by Gitee
parent 267d5db0c5
commit 834ea2dad9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 4 additions and 4 deletions

View File

@ -331,6 +331,10 @@ 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)) {
// 图形验证码 // 图形验证码
@ -339,10 +343,6 @@ public class AuthServiceImpl implements AuthService {
// 手机或者邮箱验证码 // 手机或者邮箱验证码
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("验证码错误");
}
} }
/** /**