src/Controller/SecurityController.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  7. /**
  8.  * Class SecurityController
  9.  */
  10. class SecurityController extends AbstractController
  11. {
  12.     /**
  13.      * @Route("/login", name="login")
  14.      *
  15.      * @param AuthenticationUtils $authUtils
  16.      *
  17.      * @return Response
  18.      */
  19.     public function login(AuthenticationUtils $authUtils): Response
  20.     {
  21.         $response $this->render('security/login.twig', array(
  22.             'last_username' => $authUtils->getLastUsername(),
  23.             'error'         => $authUtils->getLastAuthenticationError(),
  24.         ));
  25.         $response->setStatusCode(Response::HTTP_UNAUTHORIZED);
  26.         return $response;
  27.     }
  28. }