patch fin projet v1
This commit is contained in:
@@ -19,10 +19,8 @@ public class LoginService implements UserDetailsService {
|
||||
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
// Charger l'utilisateur depuis la base de données
|
||||
UserProfil utilisateur = this.userRep.findByUsername(username);
|
||||
UserDetails userDetails = null;
|
||||
// Créer un nouvel objet UserBuilder
|
||||
if (utilisateur != null) {
|
||||
userDetails = User.builder()
|
||||
.username(utilisateur.getPseudo())
|
||||
@@ -30,9 +28,9 @@ public class LoginService implements UserDetailsService {
|
||||
.roles(utilisateur.isAdmin() ? "ADMIN" : "MEMBRE")
|
||||
.build();
|
||||
} else {
|
||||
throw new UsernameNotFoundException("Les identifiants sont incorrect !");
|
||||
throw new UsernameNotFoundException("Les identifiants sont incorrects !");
|
||||
}
|
||||
return userDetails;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user