diff --git a/src/main/java/com/northtecom/visatrack/api/service/impl/UserService.java b/src/main/java/com/northtecom/visatrack/api/service/impl/UserService.java index f45683e..eec96be 100644 --- a/src/main/java/com/northtecom/visatrack/api/service/impl/UserService.java +++ b/src/main/java/com/northtecom/visatrack/api/service/impl/UserService.java @@ -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);