src\Controller\SecurityController.php line 49

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  8. use App\Repository\PubliciteRepository;
  9. use App\Repository\ServiceRepository;
  10. use App\Repository\VideoRepository;
  11. class SecurityController extends AbstractController
  12. {
  13.     /**
  14.      * @Route("/login", name="app_login")
  15.      */
  16.     public function login(AuthenticationUtils $authenticationUtils,ServiceRepository $ServiceRepository,
  17.                           PubliciteRepository $PubliciteRepository,VideoRepository $VideoRepository,
  18.                           Request $request): Response
  19.     {
  20.          if ($this->getUser()) {
  21.              //return $this->redirectToRoute('site_home');
  22.          }
  23.           $status=true;
  24.          $target $request->query->get('target');
  25.          $item $request->query->get('item');
  26.          //dd($target, $item);
  27.         // get the login error if there is one
  28.         $error $authenticationUtils->getLastAuthenticationError();
  29.         // last username entered by the user
  30.         $lastUsername $authenticationUtils->getLastUsername();
  31.         //return $this->render('security/login.html.twig', ['last_username' => $lastUsername, 'error' => $error]);
  32.         return $this->render('site/auth/login.html.twig', [
  33.             'last_username' => $lastUsername'error' => $error,
  34.             'services' => $ServiceRepository->FindAll(),
  35.             'videos'=>$VideoRepository->findByVA($status),
  36.             'publicites' => $PubliciteRepository->FindAll(),
  37.             'target' => $target,
  38.             'item' => $item]);
  39.     }
  40.     /**
  41.      * @Route("/inscription", name="inscription")
  42.      */
  43.     public function inscription()
  44.     {
  45.         return $this->render('site/auth/account_select.html.twig', [
  46.              //'package' => $package,
  47.              //'souscription' => $souscription,
  48.         ]);
  49.     }
  50.     /**
  51.      * @Route("/register", name="register")
  52.      */
  53.     public function register()
  54.     {
  55.         return $this->render('site/auth/account_select.html.twig', [
  56.              //'package' => $package,
  57.              //'souscription' => $souscription,
  58.         ]);
  59.     }
  60.     /**
  61.      * @Route("/deleted", name="deleted")
  62.      */
  63.     public function deleted()
  64.     {
  65.         return $this->render('site/auth/deleted.html.twig', [
  66.         ]);
  67.     }
  68.     /**
  69.      * @Route("/logout", name="app_logout")
  70.      */
  71.     public function logout()
  72.     {
  73.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  74.     }
  75. }