1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace App\Security;
- use App\Entity\User as AppUser;
- use Symfony\Component\Security\Core\Exception\AccountExpiredException;
- use Symfony\Component\Security\Core\User\UserCheckerInterface;
- use Symfony\Component\Security\Core\User\UserInterface;
- class UserChecker implements UserCheckerInterface
- {
- public function checkPreAuth(UserInterface $user)
- {
- if (!$user instanceof AppUser)
- {
- return;
- }
- }
- public function checkPostAuth(UserInterface $user)
- {
- if (!$user instanceof AppUser)
- {
- return;
- }
- if (!$user->isEnabled())
- {
- dump($user);
- throw new AccountExpiredException("Ce compte n'a pas été activé");
- }
- }
- }
|