From 933f59f132b6b9ea3ef13f2d8fcf70234329035d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=91=9C?= <727842003@qq.com> Date: Mon, 25 Jan 2021 13:44:17 +0800 Subject: [PATCH] ADD COMMENT --- .../framework/service/MongoUserDetailsServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flyfish-user/src/main/java/com/flyfish/framework/service/MongoUserDetailsServiceImpl.java b/flyfish-user/src/main/java/com/flyfish/framework/service/MongoUserDetailsServiceImpl.java index cd35434..58971ab 100644 --- a/flyfish-user/src/main/java/com/flyfish/framework/service/MongoUserDetailsServiceImpl.java +++ b/flyfish-user/src/main/java/com/flyfish/framework/service/MongoUserDetailsServiceImpl.java @@ -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, Supplier> 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);