plop
parent
375cbbc281
commit
12ac1aba25
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Security;
|
||||||
|
|
||||||
|
use App\Exception\AccountDeletedException;
|
||||||
|
use App\Security\User as AppUser;
|
||||||
|
use Symfony\Component\Security\Core\Exception\AccountExpiredException;
|
||||||
|
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// user is not activated
|
||||||
|
if ($user-> 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue