src/Controller/Account/SecurityController.php line 15

  1. <?php
  2. namespace App\Controller\Account;
  3. use App\Entity\AppConstants;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  9. class SecurityController extends AbstractController
  10. {
  11.     #[Route('/login/{evenement_reference}'name'app_user_login')]
  12.     public function index(Request $requestAuthenticationUtils $authenticationUtils, ?string $evenement_reference null)
  13.     {
  14.         $session $request->getSession();
  15.         if ($evenement_reference) {
  16.             $session->set(AppConstants::SESSION_EVENEMENT_REFERENCE$evenement_reference);
  17.         }
  18.         $error $authenticationUtils->getLastAuthenticationError();
  19.         $lastUsername $authenticationUtils->getLastUsername();
  20.         return $this->render('account/login/login.html.twig', [
  21.             'last_username' => $lastUsername,
  22.             'error' => $error,
  23.         ]);
  24.     }
  25.     #[Route('/logout'name'app_user_logout'methods: ['GET'])]
  26.     public function logout()
  27.     {
  28.         // controller can be blank: it will never be called!
  29.         throw new \Exception('Don\'t forget to activate logout in security.yaml');
  30.     }
  31. }