src/Controller/SecurityController.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Form\UserType;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  8. class SecurityController extends AbstractController
  9. {
  10.     
  11.     /**
  12.      * @Route("/login", name="app_login")
  13.      */
  14.     
  15.     public function login(AuthenticationUtils $authenticationUtils): Response
  16.     {
  17.         
  18.         $error $authenticationUtils->getLastAuthenticationError();
  19.         $lastUsername $authenticationUtils->getLastUsername();
  20.     
  21.         $form=$this->createForm(UserType::class);
  22.  
  23.         return $this->render('security/login.html.twig', [
  24.             'last_username' => $lastUsername
  25.             'form' => $form->createView(),
  26.             'error'         => $error,
  27.         ]);
  28.     }
  29.     /**
  30.      * @Route("/logout", name="app_logout")
  31.      */
  32.     public function logout(): void
  33.     {
  34.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  35.     }
  36. }