From 5e12ee14b79930c7dfa6710c9debe9570e2b7fea Mon Sep 17 00:00:00 2001 From: caihaohan Date: Thu, 14 Mar 2024 16:49:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=99=BB=E5=BD=95=E8=A2=AB=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E6=8E=89=E7=9A=84=E4=BB=A3=E7=A0=81=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/service/impl/LoginServiceImpl.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 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 b48d5bb3..efab9e0a 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 @@ -113,9 +113,8 @@ public class LoginServiceImpl implements ILoginService { //redisUtil.del(realKey); try { //解密获取密码和用户名 -// password = CommonUtils.decryptBtRsaPriKey(password, rsaPrivateKey); - password = "ABcd13@!"; - username = "075376"; + password = CommonUtils.decryptBtRsaPriKey(password, rsaPrivateKey); + username = CommonUtils.decryptBtRsaPriKey(username, rsaPrivateKey); } catch (Exception e) { e.printStackTrace(); } @@ -142,13 +141,13 @@ public class LoginServiceImpl implements ILoginService { //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); -// } + 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)) {