1 <?php
declare(strict_types
=1);
4 * This file is part of the Rapsys UserBundle package.
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Rapsys\UserBundle\Checker
;
14 use Symfony\Component\Security\Core\User\InMemoryUserChecker
;
15 use Symfony\Component\Security\Core\Exception\DisabledException
;
16 use Symfony\Component\Security\Core\User\UserInterface
;
18 use Rapsys\UserBundle\Entity\User
;
19 use Rapsys\UserBundle\Exception\UnactivatedException
;
24 class UserChecker
extends InMemoryUserChecker
{
28 public function checkPostAuth(UserInterface
$user): void {
29 //Without User instance
30 if (!$user instanceof User
) {
34 //With not activated user
35 if (!$user->isActivated()) {
36 $ex = new UnactivatedException('Account is not activated');
42 if ($user->isDisabled()) {
43 $ex = new DisabledException('Account is disabled');