src/Controller/LoginController.php line 21

  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. use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
  8. /**
  9.  * Class LoginController
  10.  *
  11.  * @package App\Controller
  12.  *
  13.  * @author Tristan Heckelsmüller <t.heckelsmueller@seonicals.de>
  14.  * @copyright Copyright (c) 2023, Seonicals GmbH
  15.  */
  16. class LoginController extends AbstractController
  17. {
  18.     #[Route('/login'name'app_login')]
  19.     public function index(AuthenticationUtils $authenticationUtilsAuthorizationCheckerInterface $authorizationChecker): Response
  20.     {
  21.         $error $authenticationUtils->getLastAuthenticationError();
  22.         // last username entered by the user
  23.         $lastUsername $authenticationUtils->getLastUsername();
  24.         return $this->render('login/index.html.twig', [
  25.             'controller_name' => 'LoginController',
  26.             'last_username' => $lastUsername,
  27.             'error' => $error,
  28.         ]);
  29.     }
  30. }