|
@@ -63,8 +63,8 @@ public class QHSELoginServiceImpl implements QHSELoginService {
|
|
if (redisService.hasKey(smsErrorKey)) {
|
|
if (redisService.hasKey(smsErrorKey)) {
|
|
errorNum = Integer.parseInt(redisService.getRedisCatchObj(smsErrorKey).toString());
|
|
errorNum = Integer.parseInt(redisService.getRedisCatchObj(smsErrorKey).toString());
|
|
}
|
|
}
|
|
- if (errorNum > 10) {
|
|
|
|
- log.error("用户:{},密码错误次数为:{}", username, errorNum + 1);
|
|
|
|
|
|
+ if (errorNum >= 10) {
|
|
|
|
+ log.error("用户:{},密码错误次数为:{}", username, errorNum);
|
|
long expireTime = redisService.getExpireTime(smsErrorKey);
|
|
long expireTime = redisService.getExpireTime(smsErrorKey);
|
|
throw new RuntimeException("密码错误次数已超过限制!请" + expireTime + "秒后再试");
|
|
throw new RuntimeException("密码错误次数已超过限制!请" + expireTime + "秒后再试");
|
|
}
|
|
}
|
|
@@ -94,13 +94,13 @@ public class QHSELoginServiceImpl implements QHSELoginService {
|
|
// 防止过期时间更新 只更新value
|
|
// 防止过期时间更新 只更新value
|
|
redisService.updateValueNoUpdateExpireTime(smsErrorKey, errorNum);
|
|
redisService.updateValueNoUpdateExpireTime(smsErrorKey, errorNum);
|
|
}
|
|
}
|
|
-
|
|
|
|
if (errorNum >= 10) {
|
|
if (errorNum >= 10) {
|
|
log.error("用户:{},密码错误次数为:{}", username, errorNum);
|
|
log.error("用户:{},密码错误次数为:{}", username, errorNum);
|
|
long expireTime = redisService.getExpireTime(smsErrorKey);
|
|
long expireTime = redisService.getExpireTime(smsErrorKey);
|
|
throw new RuntimeException("密码错误次数已超过限制!请" + expireTime + "秒后再试");
|
|
throw new RuntimeException("密码错误次数已超过限制!请" + expireTime + "秒后再试");
|
|
|
|
+ }else{
|
|
|
|
+ throw new RuntimeException("密码错误!请30秒后后再试");
|
|
}
|
|
}
|
|
- throw new RuntimeException("密码错误");
|
|
|
|
}
|
|
}
|
|
// 生成6位数验证码
|
|
// 生成6位数验证码
|
|
int smsCode = generateSms();
|
|
int smsCode = generateSms();
|