Skip to content

Commit

Permalink
fix:修复生成的 token 缺失 id导致登录校验出错 (#378)
Browse files Browse the repository at this point in the history
Co-authored-by: zhongbo <zb123456789>
  • Loading branch information
SingerDracula authored Aug 4, 2024
1 parent c52a6dd commit c2ccdca
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public UserVo register(UserParam userParam) {
user.setUsername(userParam.getUsername());
user.setPassword(AuthUtil.hash256(userParam.getPassword()));
mongoRepository.save(user);
userParam.setId(user.getId());
return createTokenAndDeleteCaptcha(userParam);
}

Expand All @@ -88,7 +89,8 @@ public UserVo login(UserParam userParam) {
//验证码
checkCaptchaIsCorrect(userParam.getCaptchaId(), userParam.getCaptcha());
//用户验证
userService.loadUserByUsernameAndPassword(userParam.getUsername(), userParam.getPassword());
User user = userService.loadUserByUsernameAndPassword(userParam.getUsername(), userParam.getPassword());
userParam.setId(user.getId());
//生成token
return createTokenAndDeleteCaptcha(userParam);
}
Expand Down

0 comments on commit c2ccdca

Please sign in to comment.