src/Controller/DefaultController.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\IpBlockedRepository;
  4. use App\Security\LoginFailureHandler;
  5. use App\Security\LoginSuccessHandler;
  6. use Doctrine\DBAL\Driver\SQLSrv\LastInsertId;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  10. use Symfony\Component\HttpFoundation\Request;
  11. use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
  12. use Doctrine\ORM\EntityManagerInterface;
  13. use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
  14. use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
  15. use Symfony\Component\Security\Core\Security;
  16. use Symfony\Component\Validator\Constraints\Length;
  17. class DefaultController extends AbstractController
  18. {
  19.     /**
  20.      * @Route("/", name="homepage")
  21.      */
  22.     public function indexAction(EntityManagerInterface $emRequest $requestAuthorizationCheckerInterface $checker)
  23.     {
  24.         if (null != $this->getUser() && $checker->isGranted('ROLE_ADMIN')) {
  25.             return $this->redirectToRoute('dashboard_index');
  26.         } else {
  27.             return $this->redirectToRoute('fos_user_security_login');
  28.         }
  29.     }
  30. }