<?php
namespace CodersLab\Lms\UserInterface\WebApp\FrontController;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Annotation\Route;
final class AppController extends AbstractController
{
/**
* @Route("/404", name="not_found")
*/
public function render404(): Response
{
throw new NotFoundHttpException('Page not found');
}
/**
* @Route("/byebye", name="app_logout", methods={"GET"})
*/
public function logoutAction(): Response
{
$url = $this->generateUrl('fos_user_security_logout');
$redirect = new RedirectResponse($url);
$redirect->headers->setCookie(new Cookie('jwt'));
return $redirect;
}
/**
* @Route("/resetting/done", name="fos_user_profile_show", methods={"GET"})
*/
public function resetDone(): Response
{
$url = $this->generateUrl('front_homepage', ['reactRouting' => '']);
return new RedirectResponse($url);
}
/**
* @Route("/{reactRouting}", name="front_homepage", requirements={"reactRouting"=".*"})
*/
public function renderFront(): Response
{
return $this->render('react_app.html.twig');
}
}