From 6441ad9f4dc3c1b2af1b9dad505c62ff75d69c4e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 08 十月 2026 15:52:17 +0800
Subject: [PATCH] 项目重构
---
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java | 44 ++------------------------------------------
1 files changed, 2 insertions(+), 42 deletions(-)
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
index 8a77ead..45d939b 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
@@ -7,15 +7,11 @@
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
-import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.model.LoginUser;
-import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.user.BlackListException;
-import com.ruoyi.common.exception.user.CaptchaException;
-import com.ruoyi.common.exception.user.CaptchaExpireException;
import com.ruoyi.common.exception.user.UserNotExistsException;
import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
import com.ruoyi.common.utils.DateUtils;
@@ -43,9 +39,6 @@
private AuthenticationManager authenticationManager;
@Autowired
- private RedisCache redisCache;
-
- @Autowired
private ISysUserService userService;
@Autowired
@@ -53,17 +46,13 @@
/**
* 鐧诲綍楠岃瘉
- *
+ *
* @param username 鐢ㄦ埛鍚�
* @param password 瀵嗙爜
- * @param code 楠岃瘉鐮�
- * @param uuid 鍞竴鏍囪瘑
* @return 缁撴灉
*/
- public String login(String username, String password, String code, String uuid)
+ public String login(String username, String password)
{
- // 楠岃瘉鐮佹牎楠�
- validateCaptcha(username, code, uuid);
// 鐧诲綍鍓嶇疆鏍¢獙
loginPreCheck(username, password);
// 鐢ㄦ埛楠岃瘉
@@ -97,35 +86,6 @@
recordLoginInfo(loginUser.getUserId());
// 鐢熸垚token
return tokenService.createToken(loginUser);
- }
-
- /**
- * 鏍¢獙楠岃瘉鐮�
- *
- * @param username 鐢ㄦ埛鍚�
- * @param code 楠岃瘉鐮�
- * @param uuid 鍞竴鏍囪瘑
- * @return 缁撴灉
- */
- public void validateCaptcha(String username, String code, String uuid)
- {
- boolean captchaEnabled = configService.selectCaptchaEnabled();
- if (captchaEnabled)
- {
- String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
- String captcha = redisCache.getCacheObject(verifyKey);
- if (captcha == null)
- {
- AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")));
- throw new CaptchaExpireException();
- }
- redisCache.deleteObject(verifyKey);
- if (!code.equalsIgnoreCase(captcha))
- {
- AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
- throw new CaptchaException();
- }
- }
}
/**
--
Gitblit v1.9.3