src/Controller/RegistrationController.php line 581

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\User;
  4. use App\Entity\Autres;
  5. use App\Entity\Adresse;
  6. use App\Entity\AgentInterne;
  7. use App\Entity\ChargeAssistance;
  8. use App\Entity\ChargeFormation;
  9. use App\Entity\Dae;
  10. use App\Entity\Delegation;
  11. use App\Entity\EnterprisePartenaire;
  12. use App\Form\AutresType;
  13. use App\Form\AdresseType;
  14. use App\Entity\Entreprise;
  15. use App\Entity\Partenaire;
  16. use App\Entity\Particulier;
  17. use App\Form\AgentInterneType;
  18. use App\Form\ChargeAssistanceType;
  19. use App\Form\ChargeFormationType;
  20. use App\Form\EntrepriseType;
  21. use App\Form\PartenaireNationalType;
  22. use App\Form\DaeType;
  23. use App\Form\PartenaireRegionalType;
  24. use App\Form\PartenaireType;
  25. use App\Form\ParticulierType;
  26. use App\Security\EmailVerifier;
  27. use App\Form\RegistrationFormType;
  28. use App\Repository\UserRepository;
  29. use App\Service\JwtService;
  30. use App\Service\SendMailService;
  31. use Symfony\Component\Mime\Address;
  32. use App\Repository\AdresseRepository;
  33. use App\Repository\DelegationRepository;
  34. use App\Repository\EnterprisePartenaireRepository;
  35. use App\Repository\GouvernoratRepository;
  36. use Doctrine\DBAL\Driver\Mysqli\Initializer\Charset;
  37. use Doctrine\ORM\EntityManagerInterface;
  38. use Doctrine\Persistence\ManagerRegistry;
  39. use Symfony\Bridge\Twig\Mime\TemplatedEmail;
  40. use Symfony\Component\HttpFoundation\Request;
  41. use Symfony\Component\HttpFoundation\Response;
  42. use Symfony\Component\Routing\Annotation\Route;
  43. use Symfony\Component\HttpFoundation\RequestStack;
  44. use Symfony\Component\Security\Http\Authentication\UserAuthenticatorInterface;
  45. use Symfony\Component\String\Slugger\SluggerInterface;
  46. use Symfony\Contracts\Translation\TranslatorInterface;
  47. use Symfony\Component\Mailer\Exception\TransportException;
  48. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  49. use Symfony\Component\HttpFoundation\JsonResponse;
  50. use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
  51. use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface;
  52. use SymfonyCasts\Bundle\VerifyEmail\VerifyEmailHelperInterface;
  53. use App\Security\UsersAuthenticator;
  54. use App\Service\FileUploader;
  55. use App\Validator\Constraints\PasswordPolicy;
  56. class RegistrationController extends AbstractController
  57. {
  58.     private const PASSWORD_POLICY_REGEX '/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$/';
  59.     private $verifyEmailHelper;
  60.     private EmailVerifier $emailVerifier;
  61.     private $request;
  62.         /**
  63.      * @var FileUploader
  64.      */
  65.     protected $fileUploader;
  66.     /**
  67.      * @param RequestStack $request
  68.      */
  69.     public function __construct(EmailVerifier $emailVerifierRequestStack $request,
  70.     FileUploader $fileUploader,
  71.     VerifyEmailHelperInterface $helper)
  72.     {
  73.         $this->emailVerifier $emailVerifier;
  74.         $this->request $request;
  75.         $this->verifyEmailHelper $helper;
  76.         $this->fileUploader $fileUploader;
  77.     }
  78.     #[Route('/register'name'app_register')]
  79.     public function register(
  80.         Request $request,
  81.         UserPasswordHasherInterface $userPasswordHasher,
  82.         EntityManagerInterface $entityManager,
  83.         UserRepository $userRepository,
  84.         GouvernoratRepository $gouvernoratRepository,
  85.         DelegationRepository $delegationRepository,
  86.         SendMailService $mailService,
  87.         JwtService $jwtService,
  88.         UserAuthenticatorInterface $userAuthenticator,
  89.         UsersAuthenticator $authenticator
  90.     ): Response {
  91.         $form_view_array = [];
  92.         $requestedType null;
  93.         $request $this->request->getCurrentRequest();
  94.         $adresse = new Adresse();
  95.         $formAdr $this->createForm(AdresseType::class);
  96.         $types = [
  97.             User::PARTIICULIER,
  98.             User::ENTREPRISE,
  99.             Partenaire::PARTENAIRE_NATIONAL,
  100.             Partenaire::PARTENAIRE_REGIONAL,
  101.             
  102.         ];
  103.         $instance_array = [
  104.             User::PARTIICULIER => new Particulier(),
  105.             User::ENTREPRISE  => new Entreprise(),
  106.             Partenaire::PARTENAIRE_NATIONAL => new Partenaire(),
  107.             Partenaire::PARTENAIRE_REGIONAL => new Partenaire(),
  108.             User::AUTRES  => new Autres(),
  109.         ];
  110.         $form_type_array = [
  111.             User::ENTREPRISE  => EntrepriseType::class,
  112.             User::PARTIICULIER => ParticulierType::class,
  113.             Partenaire::PARTENAIRE_REGIONAL => PartenaireRegionalType::class,
  114.             Partenaire::PARTENAIRE_NATIONAL => PartenaireNationalType::class,
  115.             User::AUTRES => AutresType::class,
  116.         ];
  117.         $role_array = [
  118.             User::PARTIICULIER  => 'ROLE_PARTICULIER',
  119.             User::ENTREPRISE  => 'ROLE_ENTREPRISES',
  120.             Partenaire::PARTENAIRE_REGIONAL  => 'ROLE_PARTENAIRES_REGIONAUX',
  121.             Partenaire::PARTENAIRE_NATIONAL  => 'ROLE_PARTENAIRES_NATIONAUX',
  122.             User::AUTRES => 'ROLE_AUTRES',
  123.         ];
  124.         $formAdr->handleRequest($request);
  125.         foreach ($types as $type) {
  126.             $instance $instance_array[$type];
  127.             $form $this->createForm($form_type_array[$type], $instance);
  128.             //$instance->addAdress(new Adresse());
  129.             $form_view_array[$type] = $form->createView();
  130.             $form->handleRequest($request);
  131.             if ($form->isSubmitted()) {
  132.                 if (!$form->isValid()) {
  133.                     foreach ($form->getErrors(true) as $error) {
  134.                         return new JsonResponse([
  135.                             'success' => false,
  136.                             'message' => $error->getMessage(),
  137.                         ], Response::HTTP_OK, ['Content-Type''application/json']);
  138.                     }
  139.                 }
  140.                 if ($type == "Entreprise" and count($instance->getAdresses()) > 0) {
  141.                     foreach ($request->request->all()[strtolower($type)]['adresses'] as $i => $elem) {
  142.                         $deleg =  $delg $delegationRepository->findOneBy(['id' => $elem['delegation']]);
  143.                         $instance->getAdresses()[$i]->setDelegation($deleg);
  144.                         $instance->getAdresses()[$i]->setUser($instance);
  145.                         $instance->getAdresses()[$i]->setAdresse($elem['adresse']);
  146.                         
  147.                     }
  148.                 }
  149.                 if ($type == "Entreprise" and $instance->getChargeFormations()) {
  150.                     /** mapping of created User */
  151.                     foreach ($instance->getChargeFormations() as $elem) {
  152.                         $elem->setEntreprise($instance);
  153.                     }
  154.                 }
  155.                 if (($type == "Partenaire_national" or $type == "Partenaire_regional") and $instance->getAdresses()) {
  156.                     $adress = new Adresse();
  157.                     $deleg $delegationRepository->findOneBy(['id' => $request->request->all()[strtolower($type)]['delegation']]);
  158.                     $gouv $gouvernoratRepository->findOneBy(['id' => $request->request->all()[strtolower($type)]['gouvernorat']]);
  159.                     $adress->setDelegation($deleg);
  160.                     $adress->setGouvernorat($gouv);
  161.                     $adress->setCodePostale($request->request->all()[strtolower($type)]['code_postale']);
  162.                     $adress->setAdresse($request->request->all()[strtolower                                                                                                                                                                                       ($type)]['adresse']);
  163.                     $instance->addAdress($adress);
  164.                 }
  165.                 if ($type == "Partenaire_national" or $type == "Partenaire_regional") {
  166.                     $instance->setTypePartenaire($type);
  167.                     /** mapping of created User */
  168.                     foreach ($instance->getEnterprisePartenaires() as $elem) {
  169.                         $elem->setEntreprisePartenaire($instance);
  170.                     }
  171.                 }
  172.                 if (($type == "Autres"  or $type == "Particulier") and $instance->getAdresses()) {
  173.                     $adress = new Adresse();
  174.                     $gouv $gouvernoratRepository->findOneBy(['id' => $request->request->all()[strtolower($type)]['gouvernorat']]);
  175.                     $adress->setGouvernorat($gouv);
  176.                     $adress->setCodePostale($request->request->all()[strtolower($type)]['code_postale']);
  177.                     $adress->setAdresse($request->request->all()[strtolower($type)]['adresse']);
  178.                     $instance->addAdress($adress);
  179.                 }
  180.                 $requestedType $type;
  181.                 $requestedParams $request->request->all()[strtolower($type)];
  182.        
  183.                 if ($form->get('plainPassword')->getData() != null) {
  184.                     if (!preg_match(self::PASSWORD_POLICY_REGEX, (string) $form->get('plainPassword')->getData())) {
  185.                         return new JsonResponse([
  186.                             'success' => false,
  187.                             'message' => PasswordPolicy::MESSAGE,
  188.                         ], Response::HTTP_OK, ['Content-Type''application/json']);
  189.                     }
  190.                     if (strcmp($form->get('plainPassword')->getData(), $form->get('confirmpassword')->getData()) == 0) {
  191.                         if ($form->get('plainPassword')->getData() != null) {
  192.                             $instance->setPassword(
  193.                                 $userPasswordHasher->hashPassword(
  194.                                     $instance,
  195.                                     $form->get('plainPassword')->getData()
  196.                                 )
  197.                             );
  198.                         }
  199.                     } else {
  200.                         return new JsonResponse([
  201.                             'success' => false,
  202.                             'message' => 'Les mots de passe ne sont pas identiques !'
  203.                             
  204.                         ], Response::HTTP_OK, ['Content-Type''application/json']);
  205.                     }
  206.                 }
  207.     
  208.                 // set roles
  209.                 $instance->setRoles(array($role_array[$type]));
  210.                 // set gouvernorat
  211.                 if (array_key_exists('gouvernorat'$requestedParams)) {
  212.                     $gouv $gouvernoratRepository->findOneBy(['id' => $requestedParams['gouvernorat']]);
  213.                     $adresse->setGouvernorat($gouv);
  214.                 }
  215.                 // set delegation if exist
  216.                 if (array_key_exists('delegation'$requestedParams)) {
  217.                     $delg $delegationRepository->findOneBy(['id' => $requestedParams['delegation']]);
  218.                     $adresse->setDelegation($delg);
  219.                 }
  220.                 // set adresse if exist
  221.                 if (array_key_exists('adresse'$requestedParams)) {
  222.                     $adresse->setAdresse($requestedParams['adresse']);
  223.                 }
  224.                 // set Localite if exist
  225.                 if (array_key_exists('Localite'$requestedParams)) {
  226.                     $adresse->setLocalite($requestedParams['Localite']);
  227.                 }
  228.                 // set code postale
  229.                 if (array_key_exists('code_postale'$requestedParams)) {
  230.                     $adresse->setCodePostale($requestedParams['code_postale']);
  231.                 }
  232.                 
  233.                 if (!$userRepository->findOneBy(['email' => $form->get('email')->getData()])) {
  234.                   //dd($instance);
  235.                   $entityManager->persist($instance);
  236.                   $entityManager->flush();
  237.                   // On génère le JWT de l'utilisateur
  238.                   // On crée le Header
  239.                   $header = [
  240.                       'typ' => 'JWT',
  241.                       'alg' => 'HS256'
  242.                   ];
  243.                   // On crée le Payload
  244.                   $payload = [
  245.                       'user_id' => $instance->getId()
  246.                   ];
  247.                   // On génère le token
  248.                   $token $jwtService->generate($header$payload$this->getParameter('app.jwtsecret'));
  249.                   // On envoie un mail
  250.                   $mailService->sendTranslated(
  251.                       $this->getParameter('EmailAdmin'),
  252.                       $instance->getEmail(),
  253.                       'email.subject.account_activation',
  254.                       'emails/register_mail.html.twig',
  255.                       ['username' => $instance->getUsername(), 'token' => $token],
  256.                   );
  257.                   return new JsonResponse([
  258.                       'success' => true,
  259.                       'message' => 'Votre compte a été créé avec succès, vérifiez votre boite mail pour le confirmer!'
  260.                       
  261.                   ], Response::HTTP_OK, ['Content-Type''application/json']);
  262.                  
  263.                 } else {
  264.                     return new JsonResponse([
  265.                         'success' => false,
  266.                         'message' => 'Email existe déjà !'
  267.                         
  268.                     ], Response::HTTP_OK, ['Content-Type''application/json']);
  269.                    
  270.                 }
  271.             }
  272.         }
  273.         return $this->render('registration/register.html.twig', [
  274.             'form_view_array' => $form_view_array,
  275.             'types' => $types,
  276.             'formAdr' => $formAdr->createView(),
  277.             'requestedType' => $requestedType
  278.         ]);
  279.     }
  280.     #[Route('ajax/get/delegation'name'ajax_get_delegation')]
  281.     public function getDelegation(Request $requestTranslatorInterface $translatorEntityManagerInterface $em): JsonResponse
  282.     {
  283.         $delegations $em
  284.             ->getRepository(Delegation::class)
  285.             ->getDelegationByGouvernaurat($request->query->get('gouvernorat_id'));
  286.         return new JsonResponse(json_encode($delegations));
  287.     }
  288.     #[Route('/verify/email'name'app_verify_email')]
  289.     public function verifyUserEmail(Request $requestTranslatorInterface $translatorVerifyEmailHelperInterface $verifyEmailHelper): Response
  290.     {
  291.         $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
  292.         $user $this->getUser();
  293.         // Do not get the User's Id or Email Address from the Request object
  294.         try {
  295.             $this->verifyEmailHelper->validateEmailConfirmation($request->getUri(), $user->getId(), $user->getEmail());
  296.         } catch (VerifyEmailExceptionInterface $e) {
  297.             $this->addFlash('verify_email_error'$e->getReason());
  298.             return $this->redirectToRoute('app_register');
  299.         }
  300.         // Mark your user as verified. e.g. switch a User::verified property to true
  301.         $this->addFlash('success'$translator->trans('flash.email_verified'));
  302.         return $this->redirectToRoute('accueil');
  303.     }
  304.     #[Route('/profil'name'app_profil')]
  305. public function app_profil(
  306.     Request $request,
  307.     SluggerInterface $slugger,
  308.     EntityManagerInterface $entityManager,
  309.     ManagerRegistry $registry,
  310.     GouvernoratRepository $gouvernoratRepository,
  311.     DelegationRepository $delegationRepository,
  312.     UserPasswordHasherInterface $userPasswordHasher,
  313.     EnterprisePartenaireRepository $enterprisePartenaireRepository,
  314.     UserRepository $userRepository,
  315.     AdresseRepository $adresseRepository
  316. ): Response {
  317.     $AdresseRepository $entityManager->getRepository(Adresse::class);
  318.     $adr $AdresseRepository->findOneBy(['user' => $this->getUser()]);
  319.     // Vérification utilisateur connecté
  320.     if (!$this->getUser()) {
  321.         return $this->redirectToRoute('login');
  322.     }
  323.     // Création du formulaire en fonction du type d’utilisateur
  324.     $form null;
  325.     if ($this->getUser() instanceof Partenaire) {
  326.         if ($this->getUser()->getTypePartenaire() === Partenaire::PARTENAIRE_REGIONAL) {
  327.             $form $this->createForm(PartenaireRegionalType::class, $this->getUser());
  328.         } elseif ($this->getUser()->getTypePartenaire() === Partenaire::PARTENAIRE_NATIONAL) {
  329.             $form $this->createForm(PartenaireNationalType::class, $this->getUser());
  330.         }
  331.     } elseif ($this->getUser() instanceof Particulier) {
  332.         $form $this->createForm(ParticulierType::class, $this->getUser());
  333.     } elseif ($this->getUser() instanceof Entreprise) {
  334.         $form $this->createForm(EntrepriseType::class, $this->getUser());
  335.     } elseif ($this->getUser() instanceof Autres) {
  336.         $form $this->createForm(AutresType::class, $this->getUser());
  337.     } elseif ($this->getUser() instanceof Dae) {
  338.         $form $this->createForm(DaeType::class, $this->getUser());
  339.     } elseif ($this->getUser() instanceof ChargeAssistance) {
  340.         $form $this->createForm(ChargeAssistanceType::class, $this->getUser());
  341.     } elseif ($this->getUser() instanceof AgentInterne) {
  342.         $form $this->createForm(AgentInterneType::class, $this->getUser());
  343.     }
  344.     // Si aucun formulaire trouvé → erreur explicite
  345.     if (!$form) {
  346.         throw $this->createNotFoundException('Aucun formulaire défini pour ce type d’utilisateur.');
  347.     }
  348.     // L'acceptation des CGU est requise à l'inscription uniquement, pas en modification de profil
  349.     if ($form->has('agreeTerms')) {
  350.         $form->remove('agreeTerms');
  351.     }
  352.     // Traitement du formulaire
  353.     $form->handleRequest($request);
  354.     if ($form->isSubmitted() && !$form->isValid()) {
  355.         foreach ($form->getErrors(true) as $error) {
  356.             return new JsonResponse([
  357.                 'success' => false,
  358.                 'message' => $error->getMessage(),
  359.             ]);
  360.         }
  361.     }
  362.     if ($form->isSubmitted() && $form->isValid()) {
  363.         $data $request->request->all();
  364.         if ($this->getUser() instanceof Particulier) {
  365.             $gouv $gouvernoratRepository->find((int)$data['particulier']['gouvernorat']);
  366.             $adr->setGouvernorat($gouv);
  367.             $adr->setAdresse($data['particulier']['adresse']);
  368.             $adr->setCodePostale($data['particulier']['code_postale']);
  369.         } elseif ($this->getUser() instanceof Dae) {
  370.             $gouv $gouvernoratRepository->find((int)$data['dae']['gouvernorat']);
  371.             $adr->setGouvernorat($gouv);
  372.             $adr->setAdresse($data['dae']['adresse']);
  373.             $adr->setCodePostale($data['dae']['code_postale']);
  374.         } elseif ($this->getUser() instanceof Entreprise) {
  375.             foreach ($this->getUser()->getChargeFormations() as $elem) {
  376.                 $elem->setEntreprise($this->getUser());
  377.             }
  378.         } elseif ($this->getUser() instanceof Partenaire) {
  379.             $type $this->getUser()->getTypePartenaire() === Partenaire::PARTENAIRE_NATIONAL
  380.                 "partenaire_national"
  381.                 "partenaire_regional";
  382.             $gouv $gouvernoratRepository->find((int)$data[$type]['gouvernorat']);
  383.             $delg $delegationRepository->find((int)$data[$type]['delegation']);
  384.             $adr->setGouvernorat($gouv);
  385.             $adr->setDelegation($delg);
  386.             $adr->setAdresse($data[$type]['adresse']);
  387.             $adr->setCodePostale($data[$type]['code_postale']);
  388.             $file $request->files->get($type)['fileName'] ?? null;
  389.             if ($file) {
  390.                 $newFileName $this->fileUploader->upload($file'/listEnt''docEnt');
  391.                 $this->getUser()->setFileName($newFileName);
  392.             }
  393.         } elseif ($this->getUser() instanceof Autres) {
  394.             $gouv $gouvernoratRepository->find((int)$data['autres']['gouvernorat']);
  395.             $adr->setGouvernorat($gouv);
  396.             $adr->setAdresse($data['autres']['adresse']);
  397.             $adr->setCodePostale($data['autres']['code_postale']);
  398.         }
  399.         // Vérification mot de passe
  400.         if ($form->get('plainPassword')->getData()) {
  401.             if (!preg_match(self::PASSWORD_POLICY_REGEX, (string) $form->get('plainPassword')->getData())) {
  402.                 return new JsonResponse([
  403.                     'success' => false,
  404.                     'message' => PasswordPolicy::MESSAGE,
  405.                 ]);
  406.             }
  407.             if ($form->get('plainPassword')->getData() === $form->get('confirmpassword')->getData()) {
  408.                 $this->getUser()->setPassword(
  409.                     $userPasswordHasher->hashPassword(
  410.                         $this->getUser(),
  411.                         $form->get('plainPassword')->getData()
  412.                     )
  413.                 );
  414.             } else {
  415.                 return new JsonResponse([
  416.                     'success' => false,
  417.                     'message' => 'Les mots de passe ne sont pas identiques !'
  418.                 ]);
  419.             }
  420.         }
  421.         $entityManager->persist($this->getUser());
  422.         $entityManager->flush();
  423.         return new JsonResponse([
  424.             'success' => true,
  425.             'message' => 'Profil mis à jour avec succès'
  426.         ]);
  427.     }
  428.     return $this->render('registration/profil.html.twig', [
  429.         'profilForm' => $form->createView(),
  430.         'adr' => $adr
  431.     ]);
  432. }
  433.     #[Route('/verif/{token}'name'verify_user')]
  434.     public function verifyUser($tokenJwtService $jwtUserRepository $userRepositoryEntityManagerInterface $emTranslatorInterface $translator): Response
  435.     {
  436.         //On vérifie si le token est valide, n'a pas expiré et n'a pas été modifié
  437.         if ($jwt->isValid($token) && !$jwt->isExpired($token) && $jwt->check($token$this->getParameter('app.jwtsecret'))) {
  438.             // On récupère le payload
  439.             $payload $jwt->getPayload($token);
  440.             // On récupère le user du token
  441.             $user $userRepository->find($payload['user_id']);
  442.             //On vérifie que l'utilisateur existe et n'a pas encore activé son compte
  443.             if ($user && !$user->isVerified()) {
  444.                 $user->setIsVerified(true);
  445.                 $em->flush($user);
  446.                 $this->addFlash('success'$translator->trans('flash.user_activated'));
  447.                 return $this->redirectToRoute('app_profil');
  448.             }
  449.         }
  450.         // Ici un problème se pose dans le token
  451.         $this->addFlash('danger'$translator->trans('flash.token_invalid_expired'));
  452.         return $this->redirectToRoute('login');
  453.     }
  454.     #[Route('/renvoiverif'name'resend_verif')]
  455.     public function resendVerif(JWTService $jwtSendMailService $mailUserRepository $userRepositoryTranslatorInterface $translator): Response
  456.     {
  457.         $user $this->getUser();
  458.         if (!$user) {
  459.             $this->addFlash('danger'$translator->trans('flash.must_be_logged'));
  460.             return $this->redirectToRoute('login');
  461.         }
  462.         if ($user->isVerified()) {
  463.             $this->addFlash('warning'$translator->trans('flash.user_already_activated'));
  464.             return $this->redirectToRoute('app_profil');
  465.         }
  466.         // On génère le JWT de l'utilisateur
  467.         // On crée le Header
  468.         $header = [
  469.             'typ' => 'JWT',
  470.             'alg' => 'HS256'
  471.         ];
  472.         // On crée le Payload
  473.         $payload = [
  474.             'user_id' => $user->getId()
  475.         ];
  476.         // On génère le token
  477.         $token $jwt->generate($header$payload$this->getParameter('app.jwtsecret'));
  478.         // On envoie un mail
  479.         $mail->sendTranslated(
  480.             $this->getParameter('EmailAdmin'),
  481.             $user->getEmail(),
  482.             'email.subject.account_activation',
  483.             'emails/register_mail.html.twig',
  484.             ['username' => $user->getUsername(), 'token' => $token],
  485.         );
  486.         $this->addFlash('success'$translator->trans('flash.verification_email_sent'));
  487.         return $this->redirectToRoute('app_profil');
  488.     }
  489.      protected function executeAction(Request $request): Response
  490.     {
  491.         // Récupérez les données soumises
  492.         $montant $request->request->get('entreprise_montant');
  493.         // Effectuez la validation et l'enregistrement
  494.         if (floatval($montant) === 0) {
  495.             return new Response('Le montant ne peut pas être zéro.'400);
  496.         }
  497.         // Effectuez l'enregistrement dans la base de données
  498.         return new Response('Enregistrement réussi !');
  499.     }
  500.     #[Route('/general-conditions'name'app_general_conditions')]
  501.     public function generalConditions(){
  502.         return $this->render('registration/general_conditions.html.twig', []);
  503.     }
  504. }