vendor/kunstmaan/admin-bundle/Controller/Authentication/SecurityController.php line 24

Open in your IDE?
  1. <?php
  2. namespace Kunstmaan\AdminBundle\Controller\Authentication;
  3. use Symfony\Component\HttpFoundation\Response;
  4. use Symfony\Component\Routing\Annotation\Route;
  5. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  6. use Twig\Environment;
  7. final class SecurityController
  8. {
  9.     /** @var AuthenticationUtils */
  10.     private $authenticationUtils;
  11.     /** @var Environment */
  12.     private $twig;
  13.     public function __construct(AuthenticationUtils $authenticationUtils, Environment $twig)
  14.     {
  15.         $this->authenticationUtils = $authenticationUtils;
  16.         $this->twig = $twig;
  17.     }
  18.     #[Route(path: '/login', name: 'kunstmaan_admin_login', methods: ['GET', 'POST'])]
  19.     public function loginAction()
  20.     {
  21.         $error = $this->authenticationUtils->getLastAuthenticationError();
  22.         $lastUsername = $this->authenticationUtils->getLastUsername();
  23.         return new Response($this->twig->render('@KunstmaanAdmin/authentication/login.html.twig', [
  24.             'last_username' => $lastUsername,
  25.             'error' => $error,
  26.         ]));
  27.     }
  28.     #[Route(path: '/logout', name: 'kunstmaan_admin_logout')]
  29.     public function logoutAction()
  30.     {
  31.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  32.     }
  33. }