src/Controller/Front/SecurityController.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Front;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. use Symfony\Component\Security\Core\Exception\AccessDeniedException;
  8. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  9. use App\Service\AccessClientService;
  10. class SecurityController extends AbstractController
  11. {
  12.     /**
  13.      * @Route("/login", name="app_front_login")
  14.      */
  15.     public function login(AccessClientService $accessClientServiceRequest $requestAuthenticationUtils $authenticationUtils): Response
  16.     {
  17.         $accessClientService->handleAccessControl();
  18.         $session $request->getSession();
  19.         $session->remove('login_info_slug');
  20.         $session->remove('register_info_slug');
  21.         $error $authenticationUtils->getLastAuthenticationError();
  22.         $lastUsername $authenticationUtils->getLastUsername();
  23.         return $this->render('front/security/login.html.twig', ['last_username' => $lastUsername'error' => $error]);
  24.     }
  25.     /**
  26.      * @Route("/logout", name="app_front_logout")
  27.      */
  28.     public function logout(): void
  29.     {
  30.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  31.     }
  32. }