|
@@ -0,0 +1,32 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Security;
|
|
|
+
|
|
|
+use App\Entity\User as AppUser;
|
|
|
+use Symfony\Component\Security\Core\Exception\CredentialsExpiredException;
|
|
|
+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)
|
|
|
+ {
|
|
|
+ dump($user);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!$user->isEnabled())
|
|
|
+ {
|
|
|
+ throw new CredentialsExpiredException("Ce compte n'a pas été activé");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|