mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 08:13:44 +08:00 
			
		
		
		
	update 优化 去除无用代码
This commit is contained in:
		@@ -32,7 +32,6 @@ import com.ruoyi.system.domain.vo.SysUserVo;
 | 
			
		||||
import com.ruoyi.system.mapper.SysUserMapper;
 | 
			
		||||
import com.ruoyi.system.service.ISysPermissionService;
 | 
			
		||||
import com.ruoyi.system.service.ISysTenantService;
 | 
			
		||||
import jakarta.servlet.http.HttpServletRequest;
 | 
			
		||||
import lombok.RequiredArgsConstructor;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Value;
 | 
			
		||||
@@ -74,11 +73,10 @@ public class SysLoginService {
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public String login(String tenantId, String username, String password, String code, String uuid) {
 | 
			
		||||
        HttpServletRequest request = ServletUtils.getRequest();
 | 
			
		||||
        boolean captchaEnabled = captchaProperties.getEnable();
 | 
			
		||||
        // 验证码开关
 | 
			
		||||
        if (captchaEnabled) {
 | 
			
		||||
            validateCaptcha(tenantId, username, code, uuid, request);
 | 
			
		||||
            validateCaptcha(tenantId, username, code, uuid);
 | 
			
		||||
        }
 | 
			
		||||
        // 校验租户
 | 
			
		||||
        checkTenant(tenantId);
 | 
			
		||||
@@ -177,7 +175,6 @@ public class SysLoginService {
 | 
			
		||||
     * @param username 用户名
 | 
			
		||||
     * @param status   状态
 | 
			
		||||
     * @param message  消息内容
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    private void recordLogininfor(String tenantId, String username, String status, String message) {
 | 
			
		||||
        LogininforEvent logininforEvent = new LogininforEvent();
 | 
			
		||||
@@ -220,7 +217,7 @@ public class SysLoginService {
 | 
			
		||||
     * @param code     验证码
 | 
			
		||||
     * @param uuid     唯一标识
 | 
			
		||||
     */
 | 
			
		||||
    public void validateCaptcha(String tenantId, String username, String code, String uuid, HttpServletRequest request) {
 | 
			
		||||
    public void validateCaptcha(String tenantId, String username, String code, String uuid) {
 | 
			
		||||
        String verifyKey = GlobalConstants.CAPTCHA_CODE_KEY + StringUtils.defaultString(uuid, "");
 | 
			
		||||
        String captcha = RedisUtils.getCacheObject(verifyKey);
 | 
			
		||||
        RedisUtils.deleteObject(verifyKey);
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,6 @@ import com.ruoyi.common.redis.utils.RedisUtils;
 | 
			
		||||
import com.ruoyi.common.web.config.properties.CaptchaProperties;
 | 
			
		||||
import com.ruoyi.system.domain.bo.SysUserBo;
 | 
			
		||||
import com.ruoyi.system.service.ISysUserService;
 | 
			
		||||
import jakarta.servlet.http.HttpServletRequest;
 | 
			
		||||
import lombok.RequiredArgsConstructor;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
 | 
			
		||||
@@ -37,7 +36,6 @@ public class SysRegisterService {
 | 
			
		||||
     * 注册
 | 
			
		||||
     */
 | 
			
		||||
    public void register(RegisterBody registerBody) {
 | 
			
		||||
        HttpServletRequest request = ServletUtils.getRequest();
 | 
			
		||||
        String tenantId = registerBody.getTenantId();
 | 
			
		||||
        String username = registerBody.getUsername();
 | 
			
		||||
        String password = registerBody.getPassword();
 | 
			
		||||
@@ -47,7 +45,7 @@ public class SysRegisterService {
 | 
			
		||||
        boolean captchaEnabled = captchaProperties.getEnable();
 | 
			
		||||
        // 验证码开关
 | 
			
		||||
        if (captchaEnabled) {
 | 
			
		||||
            validateCaptcha(tenantId, username, registerBody.getCode(), registerBody.getUuid(), request);
 | 
			
		||||
            validateCaptcha(tenantId, username, registerBody.getCode(), registerBody.getUuid());
 | 
			
		||||
        }
 | 
			
		||||
        SysUserBo sysUser = new SysUserBo();
 | 
			
		||||
        sysUser.setUserName(username);
 | 
			
		||||
@@ -71,9 +69,8 @@ public class SysRegisterService {
 | 
			
		||||
     * @param username 用户名
 | 
			
		||||
     * @param code     验证码
 | 
			
		||||
     * @param uuid     唯一标识
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public void validateCaptcha(String tenantId, String username, String code, String uuid, HttpServletRequest request) {
 | 
			
		||||
    public void validateCaptcha(String tenantId, String username, String code, String uuid) {
 | 
			
		||||
        String verifyKey = GlobalConstants.CAPTCHA_CODE_KEY + StringUtils.defaultString(uuid, "");
 | 
			
		||||
        String captcha = RedisUtils.getCacheObject(verifyKey);
 | 
			
		||||
        RedisUtils.deleteObject(verifyKey);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user