X-Git-Url: https://git.rapsys.eu/userbundle/blobdiff_plain/17869e03521ae16d21e3e7d7998ec23fd5da1686..5305ca069746c39ab9271fdf4ee9e14287237c21:/Checker/UserChecker.php?ds=inline diff --git a/Checker/UserChecker.php b/Checker/UserChecker.php index 1240c8a..7ea72ff 100644 --- a/Checker/UserChecker.php +++ b/Checker/UserChecker.php @@ -11,7 +11,7 @@ namespace Rapsys\UserBundle\Checker; -use Symfony\Component\Security\Core\User\UserChecker as BaseUserChecker; +use Symfony\Component\Security\Core\User\InMemoryUserChecker; use Symfony\Component\Security\Core\Exception\DisabledException; use Symfony\Component\Security\Core\User\UserInterface; @@ -21,7 +21,7 @@ use Rapsys\UserBundle\Exception\UnactivatedException; /** * {@inheritdoc} */ -class UserChecker extends BaseUserChecker { +class UserChecker extends InMemoryUserChecker { /** * {@inheritdoc} */ @@ -32,17 +32,20 @@ class UserChecker extends BaseUserChecker { } //With not activated user - if (!$user->isActivated()) { - $ex = new UnactivatedException('Account is not activated'); - $ex->setUser($user); - throw $ex; - } - - //With disabled user - if ($user->isDisabled()) { - $ex = new DisabledException('Account is disabled'); - $ex->setUser($user); - throw $ex; - } + if (!$user->isActivated()) { + $ex = new UnactivatedException('User Account is not activated'); + $ex->setUser($user); + 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); } }