<?php
namespace App\Controller\Front;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use App\Service\AccessClientService;
class SecurityController extends AbstractController
{
/**
* @Route("/login", name="app_front_login")
*/
public function login(AccessClientService $accessClientService, Request $request, AuthenticationUtils $authenticationUtils): Response
{
$accessClientService->handleAccessControl();
$session = $request->getSession();
$session->remove('login_info_slug');
$session->remove('register_info_slug');
$error = $authenticationUtils->getLastAuthenticationError();
$lastUsername = $authenticationUtils->getLastUsername();
return $this->render('front/security/login.html.twig', ['last_username' => $lastUsername, 'error' => $error]);
}
/**
* @Route("/logout", name="app_front_logout")
*/
public function logout(): void
{
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
}
}