ADD COMMENT
This commit is contained in:
parent
925cc2945f
commit
933f59f132
@ -39,6 +39,9 @@ import java.util.function.Supplier;
|
||||
@Service
|
||||
public class MongoUserDetailsServiceImpl implements MongoUserDetailsService {
|
||||
|
||||
// 登录失败限制
|
||||
private static final int ERROR_LIMIT = 5;
|
||||
|
||||
// 存储用户校验规则的map
|
||||
private static final Map<Function<User, Boolean>, Supplier<AuthenticationException>> checkMap;
|
||||
|
||||
@ -163,7 +166,7 @@ public class MongoUserDetailsServiceImpl implements MongoUserDetailsService {
|
||||
User updating = new User();
|
||||
updating.setId(user.getId());
|
||||
updating.setErrorCount(user.getErrorCount() + 1);
|
||||
if (updating.getErrorCount() >= 5) {
|
||||
if (updating.getErrorCount() >= ERROR_LIMIT) {
|
||||
updating.setStatus(UserStatus.LOCKED);
|
||||
}
|
||||
return userService.updateSelectiveById(updating);
|
||||
|
Loading…
Reference in New Issue
Block a user