|
@@ -111,7 +111,7 @@ public class AuthServiceImpl implements AuthService {
|
|
|
throw new StatusException("B-001204", "accountType is wrong");
|
|
|
}
|
|
|
|
|
|
- if (limited(accountType, accountValue, clientIp)) {
|
|
|
+ if (limited(accountTypeEnum, accountValue, clientIp)) {
|
|
|
throw new StatusException("B-001205", "密码重试次数已达到上限,请1分钟后重试");
|
|
|
}
|
|
|
|
|
@@ -162,7 +162,7 @@ public class AuthServiceImpl implements AuthService {
|
|
|
}
|
|
|
String rightPassword = userEntity.getPassword();
|
|
|
if (!rightPassword.equals(password)) {
|
|
|
- whenPasswordError(accountType, accountValue, clientIp);
|
|
|
+ whenPasswordError(accountTypeEnum, accountValue, clientIp);
|
|
|
throw new StatusException("B-001003", "账号或密码错误");
|
|
|
}
|
|
|
user.setUserId(userEntity.getId());
|
|
@@ -191,7 +191,7 @@ public class AuthServiceImpl implements AuthService {
|
|
|
}
|
|
|
String rightPassword = student.getPassword();
|
|
|
if (!rightPassword.equals(password)) {
|
|
|
- whenPasswordError(accountType, accountValue, clientIp);
|
|
|
+ whenPasswordError(accountTypeEnum, accountValue, clientIp);
|
|
|
throw new StatusException("B-001003", "账号或密码错误");
|
|
|
}
|
|
|
|
|
@@ -240,8 +240,8 @@ public class AuthServiceImpl implements AuthService {
|
|
|
* @param accountValue
|
|
|
* @param ip
|
|
|
*/
|
|
|
- private void whenPasswordError(String accountType, String accountValue, String ip) {
|
|
|
- String key = new StringBuilder("$_PW_ERR_").append(accountType).append("_")
|
|
|
+ private void whenPasswordError(AccountType accountType, String accountValue, String ip) {
|
|
|
+ String key = new StringBuilder("$_PW_ERR_").append(accountType.getCode()).append("_")
|
|
|
.append(accountValue).append("_").append(ip).toString();
|
|
|
|
|
|
Integer times = redisClient.get(key, Integer.class);
|
|
@@ -263,8 +263,8 @@ public class AuthServiceImpl implements AuthService {
|
|
|
* @param ip
|
|
|
* @return
|
|
|
*/
|
|
|
- private boolean limited(String accountType, String accountValue, String ip) {
|
|
|
- String key = new StringBuilder("$_PW_ERR_").append(accountType).append("_")
|
|
|
+ private boolean limited(AccountType accountType, String accountValue, String ip) {
|
|
|
+ String key = new StringBuilder("$_PW_ERR_").append(accountType.getCode()).append("_")
|
|
|
.append(accountValue).append("_").append(ip).toString();
|
|
|
|
|
|
Integer times = redisClient.get(key, Integer.class);
|