1. 解决 e 办密码登录时,没有跳过验证码登录的错误

(cherry picked from commit e034254b89)
This commit is contained in:
chenbowen
2025-08-19 15:08:19 +08:00
committed by chenbowen
parent c04dde88ea
commit 6e91471a5a
2 changed files with 8 additions and 0 deletions

View File

@@ -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);
// 校验访问令牌

View File

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