for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Kunstmaan\AdminBundle\Controller\Authentication;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Twig\Environment;
final class SecurityController
{
/** @var AuthenticationUtils */
private $authenticationUtils;
/** @var Environment */
private $twig;
public function __construct(AuthenticationUtils $authenticationUtils, Environment $twig)
$this->authenticationUtils = $authenticationUtils;
$this->twig = $twig;
}
/**
* @Route("/login", name="cms_login", methods={"GET", "POST"})
* @Route("/login", name="fos_user_security_login", methods={"GET", "POST"})
*/
public function loginAction()
$error = $this->authenticationUtils->getLastAuthenticationError();
$lastUsername = $this->authenticationUtils->getLastUsername();
return new Response($this->twig->render('@KunstmaanAdmin/authentication/login.html.twig', [
'last_username' => $lastUsername,
'error' => $error,
]));
* @Route("/logout", name="cms_logout")
* @Route("/logout", name="fos_user_security_logout")
public function logoutAction()
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');