src/Controller/SecurityController.php line 17

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. class SecurityController extends AbstractController
  8. {
  9. /**
  10. * @Route("/login", name="login")
  11. * @param AuthenticationUtils $authenticationUtils
  12. *
  13. * @return Response
  14. */
  15. public function login(AuthenticationUtils $authenticationUtils)
  16. {
  17. $error = $authenticationUtils->getLastAuthenticationError();
  18. $lastUsername = $authenticationUtils->getLastUsername();
  19. if($error){
  20. $this->addFlash('error', $error->getMessage());
  21. }
  22. return $this->render('security/login.html.twig', [
  23. 'last_username' => $lastUsername
  24. ]);
  25. }
  26. }