X-Git-Url: https://git.rapsys.eu/userbundle/blobdiff_plain/49d823e99f9815fca231b76aceef894531e7b42c..1c1dc3ad15562f9e6e714e231524f0da87f78734:/Checker/UserChecker.php diff --git a/Checker/UserChecker.php b/Checker/UserChecker.php index 744a35e..dc1e531 100644 --- a/Checker/UserChecker.php +++ b/Checker/UserChecker.php @@ -11,13 +11,13 @@ namespace Rapsys\UserBundle\Checker; +use Rapsys\UserBundle\Entity\User; +use Rapsys\UserBundle\Exception\UnactivatedException; + use Symfony\Component\Security\Core\User\InMemoryUserChecker; use Symfony\Component\Security\Core\Exception\DisabledException; use Symfony\Component\Security\Core\User\UserInterface; -use Rapsys\UserBundle\Entity\User; -use Rapsys\UserBundle\Exception\UnactivatedException; - /** * {@inheritdoc} */ @@ -38,6 +38,13 @@ class UserChecker extends InMemoryUserChecker { throw $ex; } + //With not enabled user + if (!$user->isEnabled()) { + $ex = new DisabledException('User account is not enabled'); + $ex->setUser($user); + throw $ex; + } + //Call parent checkPreAuth parent::checkPostAuth($user); }