src/Module/Security/Controller/LoginController.php line 29

  1. <?php
  2. namespace App\Module\Security\Controller;
  3. use App\Module\Symfony\Controller\SageController;
  4. use LogicException;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  8. class LoginController extends SageController
  9. {
  10.     #[Route('/login'name'app_login')]
  11.      public function index(AuthenticationUtils $authenticationUtils): Response
  12. {
  13.              // get the login error if there is one
  14.              $error $authenticationUtils->getLastAuthenticationError();
  15.              // last username entered by the user
  16.              $lastUsername $authenticationUtils->getLastUsername();
  17.           return $this->render('Security/template/login.html.twig', [
  18.                            'last_username' => $lastUsername,
  19.                            'error'         => $error,
  20.           ]);
  21. }
  22.      #[Route('/logout'name'app_logout' )]
  23.     public function logout()
  24.     {
  25.         throw new LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  26.     }
  27. }