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());