验证码验证默认通过
This commit is contained in:
@@ -132,18 +132,19 @@ public class VerificationServiceImpl implements VerificationService {
|
||||
*/
|
||||
@Override
|
||||
public boolean preCheck(Integer xPos, String uuid, VerificationEnums verificationEnums) {
|
||||
Integer randomX = (Integer) cache.get(cacheKey(verificationEnums, uuid));
|
||||
if (randomX == null) {
|
||||
throw new ServiceException(ResultCode.VERIFICATION_CODE_INVALID);
|
||||
}
|
||||
log.debug("{}{}", randomX, xPos);
|
||||
//验证结果正确 && 删除标记成功
|
||||
if (Math.abs(randomX - xPos) < verificationCodeProperties.getFaultTolerant() && cache.remove(cacheKey(verificationEnums, uuid))) {
|
||||
//验证成功,则记录验证结果 验证有效时间与验证码创建有效时间一致
|
||||
cache.put(cacheResult(verificationEnums, uuid), true, verificationCodeProperties.getEffectiveTime());
|
||||
return true;
|
||||
}
|
||||
throw new ServiceException(ResultCode.VERIFICATION_ERROR);
|
||||
// Integer randomX = (Integer) cache.get(cacheKey(verificationEnums, uuid));
|
||||
// if (randomX == null) {
|
||||
// throw new ServiceException(ResultCode.VERIFICATION_CODE_INVALID);
|
||||
// }
|
||||
// log.debug("{}{}", randomX, xPos);
|
||||
// //验证结果正确 && 删除标记成功
|
||||
// if (Math.abs(randomX - xPos) < verificationCodeProperties.getFaultTolerant() && cache.remove(cacheKey(verificationEnums, uuid))) {
|
||||
//验证成功,则记录验证结果 验证有效时间与验证码创建有效时间一致
|
||||
cache.remove(cacheKey(verificationEnums, uuid));
|
||||
cache.put(cacheResult(verificationEnums, uuid), true, verificationCodeProperties.getEffectiveTime());
|
||||
return true;
|
||||
// }
|
||||
// throw new ServiceException(ResultCode.VERIFICATION_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user