<?php
namespace App\Controller;
use App\Repository\IpBlockedRepository;
use App\Security\LoginFailureHandler;
use App\Security\LoginSuccessHandler;
use Doctrine\DBAL\Driver\SQLSrv\LastInsertId;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Validator\Constraints\Length;
class DefaultController extends AbstractController
{
/**
* @Route("/", name="homepage")
*/
public function indexAction(EntityManagerInterface $em, Request $request, AuthorizationCheckerInterface $checker)
{
if (null != $this->getUser() && $checker->isGranted('ROLE_ADMIN')) {
return $this->redirectToRoute('dashboard_index');
} else {
return $this->redirectToRoute('fos_user_security_login');
}
}
}