From 6c1648e18410e1122da04f5b82349178161eb790 Mon Sep 17 00:00:00 2001 From: afornerot Date: Mon, 6 Apr 2020 09:39:30 +0200 Subject: [PATCH] correction sur validation du password (ref #111) --- .../Cadoles/CoreBundle/Controller/RegistrationController.php | 2 +- .../CoreBundle/Resources/views/Registration/edit.html.twig | 3 ++- .../src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig | 3 ++- .../src/Cadoles/CoreBundle/Validator/PasswordValidator.php | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/RegistrationController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/RegistrationController.php index 78af1c23..9c872f4f 100755 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/RegistrationController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/RegistrationController.php @@ -729,7 +729,7 @@ class RegistrationController extends Controller $password=$data["password"]; $message=""; if(!empty($password)) { - if (strlen($password) < '8') { + if (strlen($password) < $this->getParameter("keyterm")) { $message = "Votre mot de passe doit contenir au minimum 8 caractères, constitué de chiffres, de lettres et caractères spéciaux"; } elseif(!preg_match("#[0-9]+#",$password)) { diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Registration/edit.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Registration/edit.html.twig index f9fab9ca..3ff1d9ff 100755 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Registration/edit.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Registration/edit.html.twig @@ -68,7 +68,8 @@
Caractères interdits = accent, espace, caractères spéciaux sauf @ . - _
- Taille minimum = 5 caractères + Taille minimum = {{keyterm}} caractères + Doit être constitué de chiffres, de lettres et caractères spéciaux
{% if form.password is defined %} diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig index fc231628..ad422948 100755 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig @@ -75,7 +75,8 @@
Caractères interdits = accent, espace, caractères spéciaux sauf @ . - _
- Taille minimum = 5 caractères + Taille minimum = {{keyterm}} caractères + Doit être constitué de chiffres, de lettres et caractères spéciaux
{% if form.password is defined %} diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Validator/PasswordValidator.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Validator/PasswordValidator.php index 29f29cb7..daa7914f 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Validator/PasswordValidator.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Validator/PasswordValidator.php @@ -9,7 +9,7 @@ class PasswordValidator extends ConstraintValidator public function validate($value, Constraint $constraint) { if(!empty($value)) { - if (strlen($value) <= '8') { + if (strlen($value) < '8') { $this->context->addViolation($constraint->message); } elseif(!preg_match("#[0-9]+#",$value)) {