diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/service/SysLoginService.java b/ruoyi-admin/src/main/java/com/ruoyi/web/service/SysLoginService.java index b853ab4b..3b8a1c65 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/service/SysLoginService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/service/SysLoginService.java @@ -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); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/service/SysRegisterService.java b/ruoyi-admin/src/main/java/com/ruoyi/web/service/SysRegisterService.java index 92e35044..819c759f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/service/SysRegisterService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/service/SysRegisterService.java @@ -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);