<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use App\Repository\PubliciteRepository;
use App\Repository\ServiceRepository;
use App\Repository\VideoRepository;
class SecurityController extends AbstractController
{
#[Route(path: '/login', name: 'app_login')]
public function login(AuthenticationUtils $authenticationUtils,ServiceRepository $ServiceRepository,
PubliciteRepository $PubliciteRepository,VideoRepository $VideoRepository,
Request $request): Response
{
if ($this->getUser()) {
//return $this->redirectToRoute('site_home');
}
$status=true;
$target = $request->query->get('target');
$item = $request->query->get('item');
//dd($target, $item);
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authenticationUtils->getLastUsername();
//return $this->render('security/login.html.twig', ['last_username' => $lastUsername, 'error' => $error]);
return $this->render('site/auth/login.html.twig', [
'last_username' => $lastUsername, 'error' => $error,
'services' => $ServiceRepository->FindAll(),
'videos'=>$VideoRepository->findByVA($status),
'publicites' => $PubliciteRepository->FindAll(),
'target' => $target,
'item' => $item]);
}
#[Route(path: '/inscription', name: 'inscription')]
public function inscription()
{
return $this->render('site/auth/account_select.html.twig', [
//'package' => $package,
//'souscription' => $souscription,
]);
}
#[Route(path: '/register', name: 'register')]
public function register()
{
return $this->render('site/auth/account_select.html.twig', [
//'package' => $package,
//'souscription' => $souscription,
]);
}
#[Route(path: '/deleted', name: 'deleted')]
public function deleted()
{
return $this->render('site/auth/deleted.html.twig', [
]);
}
#[Route(path: '/logout', name: 'app_logout')]
public function logout(): never
{
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
}
}