diff --git a/project/src/config/Validation.php b/project/src/config/Validation.php index 3140c64..85552e4 100644 --- a/project/src/config/Validation.php +++ b/project/src/config/Validation.php @@ -33,4 +33,13 @@ class Validation throw new \Exception("Erreur identifiant"); } } + + public static function valCodeInvitation(string &$codeInvitation, &$dVueErreur){ + if($codeInvitation == ''){ + $dVueErreur[] = 'Code d\'invitation invalide'; + throw new \Exception("Code d'invitation invalide"); + } + return htmlspecialchars($codeInvitation); + } + } diff --git a/project/src/controller/FrontController.php b/project/src/controller/FrontController.php index 28d5dd1..2e39149 100644 --- a/project/src/controller/FrontController.php +++ b/project/src/controller/FrontController.php @@ -46,7 +46,11 @@ class FrontController echo $twig->render('accueil.html', ['dVue' => $dVue]); break; case 'join': - echo $twig->render('join.html'); + if(isset($_POST['codeInvitation'])){ + $codeInvitation = $_POST['codeInvitation']; + Validation::valCodeInvitation($codeInvitation, $dVueErreur); + echo $twig->render('join.html'); + } break; case 'create': $this->CreateParty(); diff --git a/project/src/templates/join.html b/project/src/templates/join.html index 8d3e895..bfeb1de 100644 --- a/project/src/templates/join.html +++ b/project/src/templates/join.html @@ -11,8 +11,8 @@
Merci de vous munir de votre code de partie et de l'entrer dans le champ ci-dessous