fix:修复生成的 token 缺失 id导致登录校验出错 (#378)
Co-authored-by: zhongbo <zb123456789>
This commit is contained in:
parent
c52a6ddaa1
commit
c2ccdca147
@ -63,6 +63,7 @@ public class AuthServiceImpl implements AuthService {
|
|||||||
user.setUsername(userParam.getUsername());
|
user.setUsername(userParam.getUsername());
|
||||||
user.setPassword(AuthUtil.hash256(userParam.getPassword()));
|
user.setPassword(AuthUtil.hash256(userParam.getPassword()));
|
||||||
mongoRepository.save(user);
|
mongoRepository.save(user);
|
||||||
|
userParam.setId(user.getId());
|
||||||
return createTokenAndDeleteCaptcha(userParam);
|
return createTokenAndDeleteCaptcha(userParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +89,8 @@ public class AuthServiceImpl implements AuthService {
|
|||||||
//验证码
|
//验证码
|
||||||
checkCaptchaIsCorrect(userParam.getCaptchaId(), userParam.getCaptcha());
|
checkCaptchaIsCorrect(userParam.getCaptchaId(), userParam.getCaptcha());
|
||||||
//用户验证
|
//用户验证
|
||||||
userService.loadUserByUsernameAndPassword(userParam.getUsername(), userParam.getPassword());
|
User user = userService.loadUserByUsernameAndPassword(userParam.getUsername(), userParam.getPassword());
|
||||||
|
userParam.setId(user.getId());
|
||||||
//生成token
|
//生成token
|
||||||
return createTokenAndDeleteCaptcha(userParam);
|
return createTokenAndDeleteCaptcha(userParam);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user