From 627f5b6954925d6b8db0bca8939c4ee8d7ba452b Mon Sep 17 00:00:00 2001 From: maurine Date: Thu, 19 Mar 2026 12:09:33 +0100 Subject: [PATCH] feat: param de la page d'accueil --- src/Controller/HomeController.php | 12 ++++---- src/Controller/SecurityController.php | 30 +------------------ .../home/{hello.html.twig => home.html.twig} | 0 3 files changed, 6 insertions(+), 36 deletions(-) rename templates/home/{hello.html.twig => home.html.twig} (100%) diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 49b262e..7c96dfd 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -8,11 +8,9 @@ use Symfony\Component\Routing\Attribute\Route; class HomeController extends AbstractController { - #[Route('/hello', name: 'app_home', methods: ['GET'])] - public function hello(): Response - { - return $this->render('home/hello.html.twig', [ - 'name' => 'Melvin' - ]); - } + #[Route(path: '/', name: 'app_home', methods: ['GET'])] + public function home(): Response + { + return $this->render('home/home.html.twig'); + } } \ No newline at end of file diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index 375204d..09ddb92 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -2,8 +2,6 @@ namespace App\Controller; -use App\Repository\UserRepository; // 👈 AJOUTE CETTE LIGNE ICI ! -use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; // 👈 ET CELLE-CI AUSSI ! use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -12,35 +10,9 @@ use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; class SecurityController extends AbstractController { - #[Route(path: '/test-password', name: 'test_password')] - public function testPassword(UserRepository $userRepo, UserPasswordHasherInterface $hasher): Response - { - // 1. On va chercher ton admin directement en base - $admin = $userRepo->findOneBy(['email' => 'admin@kaz.fr']); - - if (!$admin) { - dd("L'utilisateur n'existe pas dans la base lue par ce contrôleur !"); - } - - // 2. On vérifie si "password" est bien le bon mot de passe - $isValid = $hasher->isPasswordValid($admin, 'password'); - - // 3. On affiche le résultat brut - dd([ - 'email' => $admin->getEmail(), - 'mot_de_passe_hache' => $admin->getPassword(), - 'est_ce_que_password_est_valide' => $isValid - ]); - } #[Route(path: '/login', name: 'app_login')] - public function login(AuthenticationUtils $authenticationUtils, Request $request): Response // 👈 2. ON AJOUTE $request ICI + public function login(AuthenticationUtils $authenticationUtils, Request $request): Response { - // 🚨 3. NOTRE CODE DE DÉTECTIVE POUR VOIR CE QUI EST ENVOYÉ : - if ($request->isMethod('POST')) { - dd($request->request->all()); - } - // 🚨 FIN DU CODE DE DÉTECTIVE - if ($this->getUser()) { return $this->redirectToRoute('app_home'); } diff --git a/templates/home/hello.html.twig b/templates/home/home.html.twig similarity index 100% rename from templates/home/hello.html.twig rename to templates/home/home.html.twig