代码调整

This commit is contained in:
2023-05-26 10:58:30 +08:00
parent c6f36235b5
commit e88b0e6e1b
2 changed files with 6 additions and 2 deletions

View File

@@ -48,8 +48,11 @@ public class CaptchaTokenGranter extends AbstractTokenGranter {
Map<String, String> parameters = new LinkedHashMap<>(tokenRequest.getRequestParameters()); Map<String, String> parameters = new LinkedHashMap<>(tokenRequest.getRequestParameters());
String username = parameters.get(SecurityConstants.USERNAME); String username = parameters.get(SecurityConstants.USERNAME);
username = DesUtils.aesDecrypt(username); username = DesUtils.aesDecrypt(username);
if (!judgeImageCode(parameters.get(SecurityConstants.IMAGE_CODE), RequestUtil.getRequest())) { String verifyCode = parameters.get(SecurityConstants.VERIFY_CODE);
throw new BusinessException(UserResponseEnum.LOGIN_WRONG_CODE); if(StrUtil.isEmpty(verifyCode)||verifyCode.equals("1")){
if (!judgeImageCode(parameters.get(SecurityConstants.IMAGE_CODE), RequestUtil.getRequest())) {
throw new BusinessException(UserResponseEnum.LOGIN_WRONG_CODE);
}
} }
String password = parameters.get(SecurityConstants.PASSWORD); String password = parameters.get(SecurityConstants.PASSWORD);
String ip = RequestUtil.getRequest().getHeader(SecurityConstants.REQUEST_HEADER_KEY_CLIENT_REAL_IP); String ip = RequestUtil.getRequest().getHeader(SecurityConstants.REQUEST_HEADER_KEY_CLIENT_REAL_IP);

View File

@@ -95,6 +95,7 @@ public interface SecurityConstants {
String USERNAME = "username"; String USERNAME = "username";
String PASSWORD = "password"; String PASSWORD = "password";
String IMAGE_CODE = "imageCode"; String IMAGE_CODE = "imageCode";
String VERIFY_CODE = "verifyCode";
/** /**