|
@@ -103,6 +103,8 @@ public class AuthServiceImpl implements AuthService {
|
|
|
String password = loginInfo.getPassword();
|
|
|
String clientIp = loginInfo.getClientIp();
|
|
|
String smsCode = loginInfo.getSmsCode();
|
|
|
+ String sessionId = loginInfo.getSessionId();
|
|
|
+ String imgCode = loginInfo.getImgCode();
|
|
|
|
|
|
if (StringUtils.isBlank(accountType)) {
|
|
|
throw new StatusException("B-001201", "accountType is null");
|
|
@@ -133,8 +135,17 @@ public class AuthServiceImpl implements AuthService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (5 < getLoginErrorTimes(accountTypeEnum, accountValue, clientIp)) {
|
|
|
- throw new StatusException("B-001205", "登陆失败次数已达到上限,请5分钟后重试");
|
|
|
+ // 登陆失败5次后需要图片验证码登陆,否则5分钟后才能登陆
|
|
|
+ Integer errorTimes = getLoginErrorTimes(accountTypeEnum, accountValue, clientIp);
|
|
|
+ if (5 < errorTimes) {
|
|
|
+ if (StringUtils.isBlank(sessionId) && StringUtils.isBlank(imgCode)) {
|
|
|
+ String rightImgCode = redisClient.get("$_IMG_" + sessionId, String.class);
|
|
|
+ if (null == rightImgCode || !rightImgCode.equalsIgnoreCase(imgCode)) {
|
|
|
+ throw new StatusException("B-002303", "验证码错误");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new StatusException("B-001205", "登陆失败次数已达到上限,请5分钟后重试");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
StudentEntity student = null;
|