<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
class SecurityController extends \FOS\UserBundle\Controller\SecurityController {
/**
* @var AuthorizationCheckerInterface
*/
private $authorizationChecker;
/**
* SecurityController constructor.
* @param AuthorizationCheckerInterface $authorizationChecker
* @param CsrfTokenManagerInterface|null $tokenManager
*/
public function __construct(AuthorizationCheckerInterface $authorizationChecker, CsrfTokenManagerInterface $tokenManager = null) {
parent::__construct($tokenManager);
$this->authorizationChecker = $authorizationChecker;
}
/**
* @param array $data
* @return Response
*/
protected function renderLogin(array $data): Response {
if (!empty($this->getUser())) {
return $this->redirectToRoute('home');
}
return parent::renderLogin($data);
}
}