在验证用户的 API 中需要同时返回用户定义的对象

This commit is contained in:
YuCheng Hu 2022-11-10 23:25:08 -05:00
parent a57eefc93c
commit 735607d2dc
1 changed files with 5 additions and 5 deletions

View File

@ -160,15 +160,15 @@ public class UserService implements UserDetailsService {
User user = userRepository.findByUserEmail(username).orElseThrow(() -> new UsernameNotFoundException("User " +
"not found"));
UserLoginResponse userLoginResponse = new UserLoginResponse();
userLoginResponse.setUserId(user.getId());
if (user.getUserStatus() == UserStatus.NEEDVERIFY) {
throw new BaseException(Status.USER_NOT_ACTIVE, "User is not verified");
throw new BaseException(Status.USER_NOT_ACTIVE, userLoginResponse);
}
if (!user.getIsEmailVerified()) {
UserLoginResponse userLoginResponse = new UserLoginResponse();
userLoginResponse.setUserId(user.getId());
// userLoginResponse.setEmail();
throw new BaseException(Status.USER_NOT_ACTIVE, user);
throw new BaseException(Status.USER_NOT_ACTIVE, userLoginResponse);
}
return new VisaTrackUserDetail(user);