You nedd to verify your mail in onder to login
This commit is contained in:
parent
033b52af18
commit
6b9dcf2440
2 changed files with 4 additions and 5 deletions
|
@ -55,9 +55,6 @@ public class AuthenticationController {
|
||||||
throw new UserNotFoundException();
|
throw new UserNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(user);
|
|
||||||
System.out.println(authenticationRequest);
|
|
||||||
|
|
||||||
authenticate(user.getUsername(), authenticationRequest.getPassword());
|
authenticate(user.getUsername(), authenticationRequest.getPassword());
|
||||||
userDetails = userDetailsService.loadUserByUsername(user.getUsername());
|
userDetails = userDetailsService.loadUserByUsername(user.getUsername());
|
||||||
} else {
|
} else {
|
||||||
|
@ -65,7 +62,9 @@ public class AuthenticationController {
|
||||||
authenticate(
|
authenticate(
|
||||||
authenticationRequest.getUsernameOrEmail(),
|
authenticationRequest.getUsernameOrEmail(),
|
||||||
authenticationRequest.getPassword());
|
authenticationRequest.getPassword());
|
||||||
userDetails = userDetailsService.loadUserByUsername(authenticationRequest.getUsernameOrEmail());
|
userDetails =
|
||||||
|
userDetailsService.loadUserByUsername(
|
||||||
|
authenticationRequest.getUsernameOrEmail());
|
||||||
}
|
}
|
||||||
|
|
||||||
final String token = jwtTokenUtil.generateToken(userDetails);
|
final String token = jwtTokenUtil.generateToken(userDetails);
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class JWTUserDetailsService implements UserDetailsService {
|
||||||
@Override
|
@Override
|
||||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||||
User toReturn = repository.findByUsername(username);
|
User toReturn = repository.findByUsername(username);
|
||||||
if (toReturn != null) {
|
if (toReturn != null && toReturn.getEnabled()) {
|
||||||
return new org.springframework.security.core.userdetails.User(
|
return new org.springframework.security.core.userdetails.User(
|
||||||
toReturn.getUsername(), toReturn.getPassword(), Set.of());
|
toReturn.getUsername(), toReturn.getPassword(), Set.of());
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue