src/Controller/SecurityController.php line 22

  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Log;
  4. use App\Entity\User;
  5. use Doctrine\Persistence\ManagerRegistry;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. use Symfony\Component\HttpFoundation\Request;
  9. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  10. class SecurityController extends AbstractController
  11. {
  12.     /**
  13.      * @Route("/login", name="login")
  14.      * @param Request $request
  15.      * @param AuthenticationUtils $authenticationUtils
  16.      * @return \Symfony\Component\HttpFoundation\Response
  17.      */
  18.     public function login(Request $requestAuthenticationUtils $authenticationUtils)
  19.     {
  20.         // get the login error if there is one
  21.         $error $authenticationUtils->getLastAuthenticationError();
  22.         // last username entered by the user
  23.         $lastUsername $authenticationUtils->getLastUsername();
  24.         return $this->render('security/login.html.twig', array(
  25.             'last_username' => $lastUsername,
  26.             'error'         => $error,
  27.         ));
  28.     }
  29. }