You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
992 B
PHP
36 lines
992 B
PHP
<?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();
|
|
}
|
|
}
|
|
} |