src/Infrastructure/Controller/Security/SecurityController.php line 19

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