pull/789/head
Zheng Jie 2022-03-14 08:16:37 +08:00
parent 9fab663691
commit d52ce06370
1 changed files with 6 additions and 2 deletions

View File

@ -80,10 +80,14 @@ public class AuthorizationController {
// 清除验证码 // 清除验证码
redisUtils.del(authUser.getUuid()); redisUtils.del(authUser.getUuid());
if (StringUtils.isBlank(code)) { if (StringUtils.isBlank(code)) {
throw new BadRequestException("验证码不存在或已过期"); Map<String, String> errorData = new HashMap<>(2);
errorData.put("message", "验证码不存在或已过期");
return new ResponseEntity<>(errorData, HttpStatus.BAD_REQUEST);
} }
if (StringUtils.isBlank(authUser.getCode()) || !authUser.getCode().equalsIgnoreCase(code)) { if (StringUtils.isBlank(authUser.getCode()) || !authUser.getCode().equalsIgnoreCase(code)) {
throw new BadRequestException("验证码错误"); Map<String, String> errorData = new HashMap<>(2);
errorData.put("message", "验证码错误");
return new ResponseEntity<>(errorData, HttpStatus.BAD_REQUEST);
} }
UsernamePasswordAuthenticationToken authenticationToken = UsernamePasswordAuthenticationToken authenticationToken =
new UsernamePasswordAuthenticationToken(authUser.getUsername(), password); new UsernamePasswordAuthenticationToken(authUser.getUsername(), password);