src/Controller/SecurityController.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  8. class SecurityController extends AbstractController
  9. {
  10.     /**
  11.      * @Route("/login", name="login")
  12.      */
  13.     public function login(AuthenticationUtils $authenticationUtilsRequest $request): Response
  14.     {
  15.         // get the login error if there is one
  16.         $error $authenticationUtils->getLastAuthenticationError();
  17.         // last username entered by the user
  18.         $lastUsername $authenticationUtils->getLastUsername();
  19.         return $this->render('security/login.html.twig', ['last_username' => $lastUsername'error' => $error]);
  20.     }
  21.     /**
  22.      * @Route("/logout", name="logout")
  23.      */
  24.     public function logoutAction(): Response
  25.     {
  26.         // all this method needs to do is return something
  27.         return new Response('');
  28.     }
  29. }