update 优化 去除无用代码

feature/model
疯狂的狮子li 2 years ago
parent 4db6a638d4
commit 42f5735c55

@ -32,7 +32,6 @@ import com.ruoyi.system.domain.vo.SysUserVo;
import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.ISysPermissionService; import com.ruoyi.system.service.ISysPermissionService;
import com.ruoyi.system.service.ISysTenantService; import com.ruoyi.system.service.ISysTenantService;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -74,11 +73,10 @@ public class SysLoginService {
* @return * @return
*/ */
public String login(String tenantId, String username, String password, String code, String uuid) { public String login(String tenantId, String username, String password, String code, String uuid) {
HttpServletRequest request = ServletUtils.getRequest();
boolean captchaEnabled = captchaProperties.getEnable(); boolean captchaEnabled = captchaProperties.getEnable();
// 验证码开关 // 验证码开关
if (captchaEnabled) { if (captchaEnabled) {
validateCaptcha(tenantId, username, code, uuid, request); validateCaptcha(tenantId, username, code, uuid);
} }
// 校验租户 // 校验租户
checkTenant(tenantId); checkTenant(tenantId);
@ -177,7 +175,6 @@ public class SysLoginService {
* @param username * @param username
* @param status * @param status
* @param message * @param message
* @return
*/ */
private void recordLogininfor(String tenantId, String username, String status, String message) { private void recordLogininfor(String tenantId, String username, String status, String message) {
LogininforEvent logininforEvent = new LogininforEvent(); LogininforEvent logininforEvent = new LogininforEvent();
@ -220,7 +217,7 @@ public class SysLoginService {
* @param code * @param code
* @param uuid * @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 verifyKey = GlobalConstants.CAPTCHA_CODE_KEY + StringUtils.defaultString(uuid, "");
String captcha = RedisUtils.getCacheObject(verifyKey); String captcha = RedisUtils.getCacheObject(verifyKey);
RedisUtils.deleteObject(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.common.web.config.properties.CaptchaProperties;
import com.ruoyi.system.domain.bo.SysUserBo; import com.ruoyi.system.domain.bo.SysUserBo;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -37,7 +36,6 @@ public class SysRegisterService {
* *
*/ */
public void register(RegisterBody registerBody) { public void register(RegisterBody registerBody) {
HttpServletRequest request = ServletUtils.getRequest();
String tenantId = registerBody.getTenantId(); String tenantId = registerBody.getTenantId();
String username = registerBody.getUsername(); String username = registerBody.getUsername();
String password = registerBody.getPassword(); String password = registerBody.getPassword();
@ -47,7 +45,7 @@ public class SysRegisterService {
boolean captchaEnabled = captchaProperties.getEnable(); boolean captchaEnabled = captchaProperties.getEnable();
// 验证码开关 // 验证码开关
if (captchaEnabled) { if (captchaEnabled) {
validateCaptcha(tenantId, username, registerBody.getCode(), registerBody.getUuid(), request); validateCaptcha(tenantId, username, registerBody.getCode(), registerBody.getUuid());
} }
SysUserBo sysUser = new SysUserBo(); SysUserBo sysUser = new SysUserBo();
sysUser.setUserName(username); sysUser.setUserName(username);
@ -71,9 +69,8 @@ public class SysRegisterService {
* @param username * @param username
* @param code * @param code
* @param uuid * @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 verifyKey = GlobalConstants.CAPTCHA_CODE_KEY + StringUtils.defaultString(uuid, "");
String captcha = RedisUtils.getCacheObject(verifyKey); String captcha = RedisUtils.getCacheObject(verifyKey);
RedisUtils.deleteObject(verifyKey); RedisUtils.deleteObject(verifyKey);

Loading…
Cancel
Save