From 743f8aca5e7b305602343323d3c6dcd33bb26dd8 Mon Sep 17 00:00:00 2001 From: Johan LACHENAL Date: Mon, 21 Nov 2022 19:05:47 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20d'une=20validation=20des=20mots=20de=20?= =?UTF-8?q?passe,=20ceux-ci=20ne=20doivent=20pas=20d=C3=A9passer=20les=201?= =?UTF-8?q?00=20caract=C3=A8res?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EnigmePython/genCryptarythme.py | 0 WEB/Config/Validation.php | 7 +++++++ WEB/Controller/Controller.php | 5 ++++- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 EnigmePython/genCryptarythme.py diff --git a/EnigmePython/genCryptarythme.py b/EnigmePython/genCryptarythme.py new file mode 100644 index 00000000..e69de29b diff --git a/WEB/Config/Validation.php b/WEB/Config/Validation.php index 49a0d99c..16477f87 100644 --- a/WEB/Config/Validation.php +++ b/WEB/Config/Validation.php @@ -36,4 +36,11 @@ class Validation } return true; } + public function ValidatePassword(string $password) : bool{ + if(strlen($password)>100) + { + return false; + } + return true; + } } diff --git a/WEB/Controller/Controller.php b/WEB/Controller/Controller.php index 97399bb5..25a282d3 100644 --- a/WEB/Controller/Controller.php +++ b/WEB/Controller/Controller.php @@ -54,7 +54,10 @@ class Controller throw (new Exception("Email non valide")); } if(! $validation->ValidateUsername($_REQUEST['username'])){ - throw(new Exception("Username non valide")); + throw(new Exception("Pseudo non valide")); + } + if(! $validation->ValidatePassword($_REQUEST['password'])){ + throw(new InvalidMdpException("Mot de passe non valide")); } $joueur = new Joueur($_REQUEST['email'], $_REQUEST['username'], $_REQUEST['password']); $gateway->insert($joueur);