src\Controller\SecurityController.php line 45

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.     #[Route(path'/login'name'app_login')]
  14.     public function login(AuthenticationUtils $authenticationUtils,ServiceRepository $ServiceRepository,
  15.                           PubliciteRepository $PubliciteRepository,VideoRepository $VideoRepository,
  16.                           Request $request): Response
  17.     {
  18.          if ($this->getUser()) {
  19.              //return $this->redirectToRoute('site_home');
  20.          }
  21.           $status=true;
  22.          $target $request->query->get('target');
  23.          $item $request->query->get('item');
  24.          //dd($target, $item);
  25.         // get the login error if there is one
  26.         $error $authenticationUtils->getLastAuthenticationError();
  27.         // last username entered by the user
  28.         $lastUsername $authenticationUtils->getLastUsername();
  29.         //return $this->render('security/login.html.twig', ['last_username' => $lastUsername, 'error' => $error]);
  30.         return $this->render('site/auth/login.html.twig', [
  31.             'last_username' => $lastUsername'error' => $error,
  32.             'services' => $ServiceRepository->FindAll(),
  33.             'videos'=>$VideoRepository->findByVA($status),
  34.             'publicites' => $PubliciteRepository->FindAll(),
  35.             'target' => $target,
  36.             'item' => $item]);
  37.     }
  38.     #[Route(path'/inscription'name'inscription')]
  39.     public function inscription()
  40.     {
  41.         return $this->render('site/auth/account_select.html.twig', [
  42.              //'package' => $package,
  43.              //'souscription' => $souscription,
  44.         ]);
  45.     }
  46.     #[Route(path'/register'name'register')]
  47.     public function register()
  48.     {
  49.         return $this->render('site/auth/account_select.html.twig', [
  50.              //'package' => $package,
  51.              //'souscription' => $souscription,
  52.         ]);
  53.     }
  54.     #[Route(path'/deleted'name'deleted')]
  55.     public function deleted()
  56.     {
  57.         return $this->render('site/auth/deleted.html.twig', [
  58.         ]);
  59.     }
  60.     #[Route(path'/logout'name'app_logout')]
  61.     public function logout(): never
  62.     {
  63.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  64.     }
  65. }