From 9b1b4191e44d8846e92022d8316b06760ce709e6 Mon Sep 17 00:00:00 2001 From: yjz <3131811435@qq.com> Date: Fri, 22 Dec 2023 10:02:37 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=99=BB=E5=BD=95):=20=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E5=AF=86=E7=A0=81=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/service/impl/LoginServiceImpl.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/laws-module-system/src/main/java/com/jero/modules/system/service/impl/LoginServiceImpl.java b/laws-module-system/src/main/java/com/jero/modules/system/service/impl/LoginServiceImpl.java index af41dbbe..5c53b2ff 100644 --- a/laws-module-system/src/main/java/com/jero/modules/system/service/impl/LoginServiceImpl.java +++ b/laws-module-system/src/main/java/com/jero/modules/system/service/impl/LoginServiceImpl.java @@ -139,15 +139,15 @@ public class LoginServiceImpl implements ILoginService { return Result.error("密码错误次数过多,请15分钟后重试"); } //2. 校验用户名或密码是否正确 -// String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt()); -// String syspassword = sysUser.getPassword(); -// if (!syspassword.equals(userpassword)) { -// // 重试登录次数加一 -// retryCount++; -// this.setRetryInfoToRedis(username, retryCount); -// String msg = retryCount == RETRY_LOGIN_MAX_COUNT ? "密码错误次数过多,请稍后重试":"用户名或密码错误,剩余可登录次数:"+(RETRY_LOGIN_MAX_COUNT - retryCount); -// return Result.error(msg); -// } + String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt()); + String syspassword = sysUser.getPassword(); + if (!syspassword.equals(userpassword)) { + // 重试登录次数加一 + retryCount++; + this.setRetryInfoToRedis(username, retryCount); + String msg = retryCount == RETRY_LOGIN_MAX_COUNT ? "密码错误次数过多,请稍后重试":"用户名或密码错误,剩余可登录次数:"+(RETRY_LOGIN_MAX_COUNT - retryCount); + return Result.error(msg); + } //登录成功,清除错误登录次数 redisUtil.del(RETRY_LOGIN_PREFIX + username); if (checkSysPermission(username)) {