1.登录验证码可选

This commit is contained in:
2024-07-25 17:40:54 +08:00
parent c7d4757c64
commit ae8fdd72b3
2 changed files with 4 additions and 2 deletions

View File

@@ -87,10 +87,10 @@ public class AuthorizationController {
String code = (String) redisUtils.get(authUser.getUuid());
// 清除验证码
redisUtils.del(authUser.getUuid());
if (StringUtils.isBlank(code)) {
if (authUser.isChecked() && StringUtils.isBlank(code)) {
throw new BadRequestException("验证码不存在或已过期");
}
if (StringUtils.isBlank(authUser.getCode()) || !authUser.getCode().equalsIgnoreCase(code)) {
if (authUser.isChecked() && StringUtils.isBlank(authUser.getCode()) || authUser.isChecked() && !authUser.getCode().equalsIgnoreCase(code)) {
throw new BadRequestException("验证码错误");
}
//生成token

View File

@@ -36,4 +36,6 @@ public class AuthUserDto {
private String code;
private String uuid = "";
private boolean checked = true;
}