src/Controller/IndexController.php line 36

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. class IndexController extends AbstractController
  7. {
  8.     #[Route('/'name'index')]
  9.     public function index(): Response
  10.     {
  11.         if($this->getUser()){
  12.             if($this->getUser()->getAgent() !== null){
  13.                 if($this->getUser()->getPasswordChanged() === false){
  14.                     return $this->redirect("/newpassword");
  15.                 }
  16.                 if($this->getUser() && $this->isgranted('ROLE_ADMIN')){
  17.                     return $this->redirect("/select");
  18.                 }else if($this->getUser() && $this->isgranted('ROLE_AGENT') || $this->getUser() && $this->isgranted('ROLE_RETRAITE')){
  19.                     return $this->redirect("/dashboard");
  20.                 }else{
  21.                     return $this->redirectToRoute('app_login');
  22.                 }
  23.             }else{
  24.                 return $this->redirect("/informations");
  25.             }
  26.         }else{
  27.             return $this->redirectToRoute('app_login');
  28.         }
  29.     }
  30.     #[Route('/{route}'name'vue_pages'requirements: ["route"=>"^(?!api|login|select|administration|registration|logout|upload|documents|images|password|_(profiler|wdt)).+"])]
  31.     public function agentIndex(): Response
  32.     {
  33.         return $this->render('index.html.twig');
  34.     }
  35.     #[Route('/select'name'select')]
  36.     public function selectApplication(): Response
  37.     {
  38.         return $this->render('/security/select.html.twig');
  39.     }
  40. }