diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 0ecece0..bece817 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -14,8 +14,11 @@ security: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false + main: anonymous: ~ + pattern: ^/ + user_checker: App\Security\UserChecker guard: authenticators: - App\Security\LoginFormAuthentificatorAuthenticator diff --git a/src/Security/UserChecker.php b/src/Security/UserChecker.php new file mode 100644 index 0000000..a146b9a --- /dev/null +++ b/src/Security/UserChecker.php @@ -0,0 +1,36 @@ + getActive() === false) { + throw new AccountDeletedException(); + } + } + + public function checkPostAuth(UserInterface $user) + { + if (!$user instanceof AppUser) { + return; + } + + // user is not activated + if ($user->getActive() === false) { + throw new AccountDeletedException(); + } + } +} \ No newline at end of file