From e034254b892ff6f4cd9c5f8f4d455dd14fec2578 Mon Sep 17 00:00:00 2001 From: chenbowen Date: Tue, 19 Aug 2025 15:08:19 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=A7=A3=E5=86=B3=20e=20=E5=8A=9E?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E7=99=BB=E5=BD=95=E6=97=B6=EF=BC=8C=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=B7=B3=E8=BF=87=E9=AA=8C=E8=AF=81=E7=A0=81=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controller/admin/sync/SyncController.java | 1 + .../module/system/service/auth/AdminAuthServiceImpl.java | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/yudao-module-system/yudao-module-system-server/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sync/SyncController.java b/yudao-module-system/yudao-module-system-server/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sync/SyncController.java index 836f4947..cceaa50d 100644 --- a/yudao-module-system/yudao-module-system-server/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sync/SyncController.java +++ b/yudao-module-system/yudao-module-system-server/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sync/SyncController.java @@ -275,6 +275,7 @@ public class SyncController { AuthLoginReqVO authLoginReqVO = new AuthLoginReqVO(); authLoginReqVO.setUsername((String) map.getOrDefault("bimRemoteUser", "")); authLoginReqVO.setPassword((String) map.getOrDefault("bimRemotePwd", "")); + authLoginReqVO.setCaptchaVerification(encryptKey); AuthLoginRespVO login = adminAuthService.login(authLoginReqVO); // 校验访问令牌 diff --git a/yudao-module-system/yudao-module-system-server/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java b/yudao-module-system/yudao-module-system-server/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java index a931efbc..1d2072d8 100644 --- a/yudao-module-system/yudao-module-system-server/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java +++ b/yudao-module-system/yudao-module-system-server/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java @@ -32,6 +32,7 @@ import jakarta.annotation.Resource; import jakarta.validation.Validator; import lombok.Setter; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -67,6 +68,8 @@ public class AdminAuthServiceImpl implements AdminAuthService { private CaptchaService captchaService; @Resource private SmsCodeApi smsCodeApi; + @Value("${sync.encrypt-key}") + private String encryptKey; /** * 验证码的开关,默认为 true @@ -200,6 +203,10 @@ public class AdminAuthServiceImpl implements AdminAuthService { if (!captchaEnable) { return ResponseModel.success(); } + // 如果 encryptKey 不为空并且与 reqVO 的验证码一致,则直接返回成功 + if (StringUtils.isNotBlank(encryptKey) && StringUtils.equals(reqVO.getCaptchaVerification(), encryptKey)) { + return ResponseModel.success(); + } ValidationUtils.validate(validator, reqVO, CaptchaVerificationReqVO.CodeEnableGroup.class); CaptchaVO captchaVO = new CaptchaVO(); captchaVO.setCaptchaVerification(reqVO.getCaptchaVerification());