src/User/UI/Http/Controller/Web/LoginUserController.php line 10

  1. <?php
  2. namespace App\User\UI\Http\Controller\Web;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  6. final class LoginUserController extends AbstractController
  7. {
  8.     /**
  9.      * @param Request $request
  10.      * @return \Symfony\Component\HttpFoundation\Response
  11.      */
  12.     public function __invoke(AuthenticationUtils $authenticationUtils)
  13.     {
  14.         // get the login error if there is one
  15.         $error $authenticationUtils->getLastAuthenticationError();
  16.         // last username entered by the user
  17.         $lastUsername $authenticationUtils->getLastUsername();
  18.         return $this->render('security/login.html.twig', [
  19.             'last_username' => $lastUsername,
  20.             'error' => $error,
  21.         ]);
  22.     }
  23. }