记得上下班打卡 | git大法好,push需谨慎

Commit b6dc972f authored by 张国柄's avatar 张国柄

~api:设置安全密码校验逻辑调整;

parent 461e0920
......@@ -76,17 +76,11 @@ public class GoblinSmsController {
public ResponseDto<Object> checkVerificationCode(@Pattern(regexp = "\\d{6}", message = "验证码格式有误") @RequestParam String code) {
String mobile = (String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE);
if (!LnsEnum.ENV.prod.name().equals(env.getProperty(CurrentUtil.CK_ENV_ACTIVE))) {
if (CurrentUtil.GRAY_LOGIN_SMS_CODE.equals(code)) {
return ResponseDto.success();
}
if (CurrentUtil.GRAY_LOGIN_SMS_CODE.equals(code)) return ResponseDto.success();
}
String smsCodeByMobile = goblinRedisUtils.getSmsCodeByMobile(mobile);
if (null == smsCodeByMobile) {
return ResponseDto.failure(ErrorMapping.get("140018"));
}
if (smsCodeByMobile.equals(code)) {
return ResponseDto.success();
}
return ResponseDto.failure(ErrorMapping.get("140019"));
if (null == smsCodeByMobile) return ResponseDto.failure(ErrorMapping.get("140018"));
return smsCodeByMobile.equals(code) ? ResponseDto.success() : ResponseDto.failure(ErrorMapping.get("140019"));
}
}
......@@ -21,6 +21,7 @@ import org.springframework.core.env.Environment;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
......@@ -52,15 +53,13 @@ public class GoblinUserSafeController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "code", value = "验证码"),
})
@PostMapping(value = {"passwd/set"})
public ResponseDto<Object> setSecurityCode(@Size(min = 32, max = 32, message = "安全密码无效") @RequestParam String passwd,
@Pattern(regexp = "\\d{6}", message = "验证码格式有误") @RequestParam String code
public ResponseDto<Object> setSecurityCode(@NotBlank(message = "安全密码不能为空") @Size(min = 32, max = 32, message = "安全密码无效") @RequestParam String passwd,
@NotBlank(message = "验证码不能为空") @Pattern(regexp = "\\d{6}", message = "验证码格式有误") @RequestParam String code
) {
String currentUid = CurrentUtil.getCurrentUid(), currentMobile = (String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE);
if (!LnsEnum.ENV.prod.name().equals(env.getProperty(CurrentUtil.CK_ENV_ACTIVE))) {
if (!CurrentUtil.GRAY_LOGIN_SMS_CODE.equals(code)) {
return ResponseDto.failure(ErrorMapping.get("140001"));
if (CurrentUtil.GRAY_LOGIN_SMS_CODE.equals(code)) return ResponseDto.success();
}
} else {
String cacheCode = goblinRedisUtils.getSmsCodeByMobile(currentMobile);
if (StringUtils.isEmpty(cacheCode)) {
return ResponseDto.failure(ErrorMapping.get("140018"));
......@@ -68,7 +67,6 @@ public class GoblinUserSafeController {
if (!cacheCode.equals(code)) {
return ResponseDto.failure(ErrorMapping.get("140001"));
}
}
GoblinUserSafeConfigDto userSafeConfigDto = goblinRedisUtils.getUserSafeConfigDto(currentUid);
if (null != userSafeConfigDto) {
return ResponseDto.failure(ErrorMapping.get("140020"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment