验证用户密码匹配

pull/875/head
Jie Zheng 2025-02-17 16:15:43 +08:00
parent 51560f3f82
commit c558069be8
1 changed files with 3 additions and 0 deletions

View File

@ -102,6 +102,9 @@ public class AuthController {
JwtUserDto jwtUser = userDetailsService.loadUserByUsername(authUser.getUsername()); JwtUserDto jwtUser = userDetailsService.loadUserByUsername(authUser.getUsername());
// 验证用户密码 // 验证用户密码
if (!passwordEncoder.matches(password, jwtUser.getPassword())) { if (!passwordEncoder.matches(password, jwtUser.getPassword())) {
// todo 验证下数据
log.info("jwtUser pwd: {}", jwtUser.getPassword());
log.info("authUser pwd: {}", password);
throw new BadRequestException("登录密码错误"); throw new BadRequestException("登录密码错误");
} }
Authentication authentication = new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities()); Authentication authentication = new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities());