From 22c1a9618a62087b814f32cc8d01706b610f2d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Thu, 17 Aug 2023 16:50:07 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E5=BC=80=E5=85=B3=E6=9C=AA=E5=8A=A8=E6=80=81=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/service/impl/PasswordAuthStrategy.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ruoyi-auth/src/main/java/org/dromara/auth/service/impl/PasswordAuthStrategy.java b/ruoyi-auth/src/main/java/org/dromara/auth/service/impl/PasswordAuthStrategy.java index e9073c39..f261f357 100644 --- a/ruoyi-auth/src/main/java/org/dromara/auth/service/impl/PasswordAuthStrategy.java +++ b/ruoyi-auth/src/main/java/org/dromara/auth/service/impl/PasswordAuthStrategy.java @@ -7,13 +7,14 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.config.annotation.DubboReference; import org.dromara.auth.domain.vo.LoginVo; -import org.dromara.common.core.exception.CaptchaException; -import org.dromara.common.core.domain.model.LoginBody; +import org.dromara.auth.properties.CaptchaProperties; import org.dromara.auth.service.IAuthStrategy; import org.dromara.auth.service.SysLoginService; import org.dromara.common.core.constant.Constants; import org.dromara.common.core.constant.GlobalConstants; +import org.dromara.common.core.domain.model.LoginBody; import org.dromara.common.core.enums.LoginType; +import org.dromara.common.core.exception.CaptchaException; import org.dromara.common.core.exception.user.CaptchaExpireException; import org.dromara.common.core.utils.MessageUtils; import org.dromara.common.core.utils.ServletUtils; @@ -25,7 +26,6 @@ import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.system.api.RemoteUserService; import org.dromara.system.api.domain.vo.RemoteClientVo; import org.dromara.system.api.model.LoginUser; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; /** @@ -38,8 +38,7 @@ import org.springframework.stereotype.Service; @RequiredArgsConstructor public class PasswordAuthStrategy implements IAuthStrategy { - @Value("${security.captcha.enabled}") - private Boolean captchaEnabled; + private final CaptchaProperties captchaProperties; private final SysLoginService loginService; @@ -60,7 +59,7 @@ public class PasswordAuthStrategy implements IAuthStrategy { String uuid = loginBody.getUuid(); // 验证码开关 - if (captchaEnabled) { + if (captchaProperties.getEnabled()) { validateCaptcha(tenantId, username, code, uuid); }