src/Controller/SecurityController.php line 34

  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  7. class SecurityController extends AbstractController
  8. {
  9.     #[Route(path'/login'name'app_login')]
  10.     public function login(AuthenticationUtils $authenticationUtils): Response
  11.     {
  12.         if ($this->getUser()) {
  13.             return $this->redirectToRoute('app_dashboard');
  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('dashboard/login.html.twig', ['last_username' => $lastUsername'error' => $error]);
  20.     }
  21.     #[Route(path'/'name'app_login_2')]
  22.     public function login2(): Response
  23.     {      
  24.         return $this->redirectToRoute('politique_confidentialite');
  25.     }
  26.     #[Route(path'/politique-de-confidentialite'name'politique_confidentialite')]
  27.     public function confidentialite(): Response
  28.     {      
  29.         return $this->render('security/politique_de_confidentialite.html.twig');
  30.     }
  31.     #[Route(path'/condition-generale-utilisation'name'condition_generale_utilisation')]
  32.     public function conditionUtilisation(): Response
  33.     {      
  34.         return $this->render('security/condition_generale_utilisation.html.twig');
  35.     }
  36.     #[Route(path'/mention-legale'name'mention_legale')]
  37.     public function mentionLegale(): Response
  38.     {      
  39.         return $this->render('security/mention_legale.html.twig');
  40.     }
  41.     #[Route(path'/logout'name'app_logout')]
  42.     public function logout(): void
  43.     {
  44.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  45.     }
  46. }