修改验证码没有与用户输入进行校验

This commit is contained in:
Minsim 2021-08-04 18:13:45 +08:00
parent 23cb3b777d
commit 492610fe2e
1 changed files with 2 additions and 8 deletions

View File

@ -118,9 +118,6 @@ public class ValidateCodeGatewayFilter extends AbstractGatewayFilterFactory<Obje
} }
String key = CacheConstants.DEFAULT_CODE_KEY + randomStr; String key = CacheConstants.DEFAULT_CODE_KEY + randomStr;
if (Boolean.FALSE.equals(redisTemplate.hasKey(key))) {
throw new ValidateCodeException("验证码不合法");
}
Object codeObj = redisTemplate.opsForValue().get(key); Object codeObj = redisTemplate.opsForValue().get(key);
@ -128,13 +125,10 @@ public class ValidateCodeGatewayFilter extends AbstractGatewayFilterFactory<Obje
throw new ValidateCodeException("验证码不合法"); throw new ValidateCodeException("验证码不合法");
} }
String saveCode = codeObj.toString();
if (CharSequenceUtil.isBlank(saveCode)) {
redisTemplate.delete(key); redisTemplate.delete(key);
if (!code.equals(codeObj)) {
throw new ValidateCodeException("验证码不合法"); throw new ValidateCodeException("验证码不合法");
} }
redisTemplate.delete(key);
} }
} }