From 59c2d1445a1fd22b865ccf8ce02a538bb9a19dc5 Mon Sep 17 00:00:00 2001 From: Olivier PARPAILLON Date: Tue, 19 Nov 2024 16:09:46 +0100 Subject: [PATCH] add Johan code --- src/Security/LoginFormAuthenticator.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Security/LoginFormAuthenticator.php b/src/Security/LoginFormAuthenticator.php index 66d0d38..082013b 100644 --- a/src/Security/LoginFormAuthenticator.php +++ b/src/Security/LoginFormAuthenticator.php @@ -7,6 +7,7 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\UserNotFoundException; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Http\Authenticator\AbstractAuthenticator; use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials; @@ -45,6 +46,10 @@ class LoginFormAuthenticator extends AbstractAuthenticator 'pseudo' => $identifier ]); + if (!$user || $user->isActif()) { + throw new UserNotFoundException('Utilisateur non trouvé'); + } + if (!$user) { throw new AuthenticationException('Identifiant ou mot de passe incorrect.'); }