v0.2.12 登录校验修正
parent
252ea9f769
commit
791e438b99
|
|
@ -27,6 +27,7 @@ public class AuthController {
|
|||
@PostMapping("/login")
|
||||
public AjaxResult login(@RequestBody LoginRequest loginRequest) {
|
||||
// 认证成功,返回 JWT 令牌
|
||||
System.out.println(loginRequest.toString());
|
||||
String token = authService.authenticate(loginRequest);
|
||||
return AjaxResult.success("登录成功", token);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ public class AuthServiceImpl implements AuthService {
|
|||
} else if (!loginRequest.getEmail().isEmpty()) {
|
||||
user = userMapper.findByEmail(loginRequest.getEmail());
|
||||
}
|
||||
System.out.println(user);
|
||||
// 用户不存在
|
||||
if (user == null) {
|
||||
throw new UserNotFoundException();
|
||||
|
|
@ -54,6 +55,7 @@ public class AuthServiceImpl implements AuthService {
|
|||
|
||||
// 检查密码是否匹配
|
||||
if (!PasswordUtil.matches(loginRequest.getPassword(), user.getPassword())) {
|
||||
|
||||
throw new PasswordIncorrectException();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue