1. 解决 e 办密码登录时,没有跳过验证码登录的错误
This commit is contained in:
@@ -275,6 +275,7 @@ public class SyncController {
|
|||||||
AuthLoginReqVO authLoginReqVO = new AuthLoginReqVO();
|
AuthLoginReqVO authLoginReqVO = new AuthLoginReqVO();
|
||||||
authLoginReqVO.setUsername((String) map.getOrDefault("bimRemoteUser", ""));
|
authLoginReqVO.setUsername((String) map.getOrDefault("bimRemoteUser", ""));
|
||||||
authLoginReqVO.setPassword((String) map.getOrDefault("bimRemotePwd", ""));
|
authLoginReqVO.setPassword((String) map.getOrDefault("bimRemotePwd", ""));
|
||||||
|
authLoginReqVO.setCaptchaVerification(encryptKey);
|
||||||
AuthLoginRespVO login = adminAuthService.login(authLoginReqVO);
|
AuthLoginRespVO login = adminAuthService.login(authLoginReqVO);
|
||||||
// 校验访问令牌
|
// 校验访问令牌
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import jakarta.annotation.Resource;
|
|||||||
import jakarta.validation.Validator;
|
import jakarta.validation.Validator;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -67,6 +68,8 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
private CaptchaService captchaService;
|
private CaptchaService captchaService;
|
||||||
@Resource
|
@Resource
|
||||||
private SmsCodeApi smsCodeApi;
|
private SmsCodeApi smsCodeApi;
|
||||||
|
@Value("${sync.encrypt-key}")
|
||||||
|
private String encryptKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证码的开关,默认为 true
|
* 验证码的开关,默认为 true
|
||||||
@@ -200,6 +203,10 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
if (!captchaEnable) {
|
if (!captchaEnable) {
|
||||||
return ResponseModel.success();
|
return ResponseModel.success();
|
||||||
}
|
}
|
||||||
|
// 如果 encryptKey 不为空并且与 reqVO 的验证码一致,则直接返回成功
|
||||||
|
if (StringUtils.isNotBlank(encryptKey) && StringUtils.equals(reqVO.getCaptchaVerification(), encryptKey)) {
|
||||||
|
return ResponseModel.success();
|
||||||
|
}
|
||||||
ValidationUtils.validate(validator, reqVO, CaptchaVerificationReqVO.CodeEnableGroup.class);
|
ValidationUtils.validate(validator, reqVO, CaptchaVerificationReqVO.CodeEnableGroup.class);
|
||||||
CaptchaVO captchaVO = new CaptchaVO();
|
CaptchaVO captchaVO = new CaptchaVO();
|
||||||
captchaVO.setCaptchaVerification(reqVO.getCaptchaVerification());
|
captchaVO.setCaptchaVerification(reqVO.getCaptchaVerification());
|
||||||
|
|||||||
Reference in New Issue
Block a user