src/Controller/Public/SecurityController.php line 15
<?phpnamespace App\Controller\Public;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\Routing\Annotation\Route;use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;use Symfony\UX\Turbo\TurboBundle;class SecurityController extends AbstractController{#[Route('/', name: 'login')]public function index(AuthenticationUtils $authenticationUtils, Request $request): Response{if ($this->isGranted('ROLE_ADMIN')) {return $this->redirectToRoute('app_admin_dashboard_index');} elseif ($this->isGranted('ROLE_CLIENT')) {return $this->redirectToRoute('app_client_dashboard');} elseif ($this->isGranted('ROLE_USER') && $this->getUser()->isVerified() === false) {return $this->redirectToRoute('app_public_unverified_user');} elseif ($this->isGranted('ROLE_USER') && $this->getUser()->isVerified() === true) {return $this->redirectToRoute('app_public_awaiting_validation_user');}$error = $authenticationUtils->getLastAuthenticationError();$lastUsername = $authenticationUtils->getLastUsername();if (TurboBundle::STREAM_FORMAT === $request->getPreferredFormat() && $request->getRealMethod() === Request::METHOD_POST) {$request->setRequestFormat(TurboBundle::STREAM_FORMAT);return $this->renderForm('security/login.stream.html.twig', ['last_username' => $lastUsername,'error' => $error,]);}return $this->renderForm('security/login.html.twig', ['last_username' => $lastUsername,'error' => $error,]);}#[Route('/logout', name: 'logout', methods: ['GET'])]public function logout(){// controller can be blank: it will never be called!throw new \Exception('Don\'t forget to activate logout in security.yaml');}}