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.'); }