src/AppBundle/Controller/SecurityController.php line 15

Open in your IDE?
  1. <?php
  2. namespace AppBundle\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  7. class SecurityController extends AbstractController
  8. {
  9.     /**
  10.      * @Route("/login", name="login")
  11.      */
  12.     public function indexAction(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(
  19.             'security/login.html.twig',
  20.             array(
  21.                 // last username entered by the user
  22.                 'last_username' => $lastUsername,
  23.                 'error'         => $error,
  24.             )
  25.         );
  26.     }
  27. }