<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class IndexController extends AbstractController
{
#[Route('/', name: 'index')]
public function index(): Response
{
if($this->getUser()){
if($this->getUser()->getAgent() !== null){
if($this->getUser()->getPasswordChanged() === false){
return $this->redirect("/newpassword");
}
if($this->getUser() && $this->isgranted('ROLE_ADMIN')){
return $this->redirect("/select");
}else if($this->getUser() && $this->isgranted('ROLE_AGENT') || $this->getUser() && $this->isgranted('ROLE_RETRAITE')){
return $this->redirect("/dashboard");
}else{
return $this->redirectToRoute('app_login');
}
}else{
return $this->redirect("/informations");
}
}else{
return $this->redirectToRoute('app_login');
}
}
#[Route('/{route}', name: 'vue_pages', requirements: ["route"=>"^(?!api|login|select|administration|registration|logout|upload|documents|images|password|_(profiler|wdt)).+"])]
public function agentIndex(): Response
{
return $this->render('index.html.twig');
}
#[Route('/select', name: 'select')]
public function selectApplication(): Response
{
return $this->render('/security/select.html.twig');
}
}