src/Controller/SecurityController.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Component\HttpFoundation\Response;
  4. use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
  5. use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
  6. class SecurityController extends \FOS\UserBundle\Controller\SecurityController {
  7.     /**
  8.      * @var AuthorizationCheckerInterface
  9.      */
  10.     private $authorizationChecker;
  11.     /**
  12.      * SecurityController constructor.
  13.      * @param AuthorizationCheckerInterface  $authorizationChecker
  14.      * @param CsrfTokenManagerInterface|null $tokenManager
  15.      */
  16.     public function __construct(AuthorizationCheckerInterface $authorizationCheckerCsrfTokenManagerInterface $tokenManager null) {
  17.         parent::__construct($tokenManager);
  18.         $this->authorizationChecker $authorizationChecker;
  19.     }
  20.     /**
  21.      * @param array $data
  22.      * @return Response
  23.      */
  24.     protected function renderLogin(array $data): Response {
  25.         if (!empty($this->getUser())) {
  26.             return $this->redirectToRoute('home');
  27.         }
  28.         return parent::renderLogin($data);
  29.     }
  30. }