]> git.agnieray.net Git - galette.git/commitdiff
Validate password after other data have been populated
authorJohan Cwiklinski <johan@x-tnd.be>
Sat, 6 Nov 2021 10:24:14 +0000 (11:24 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Sun, 7 Nov 2021 05:50:39 +0000 (06:50 +0100)
galette/lib/Galette/Entity/Adherent.php

index c6d9f6ae180c387310deef68be2da3f298a5f246..974ba2d09ba2e4bcd8d56f1ba206b3962da9f0a1 100644 (file)
@@ -1127,7 +1127,9 @@ class Adherent
 
                 // now, check validity
                 if ($value !== null && $value != '') {
-                    $this->validate($key, $value, $values);
+                    if ($key !== 'mdp_adh') {
+                        $this->validate($key, $value, $values);
+                    }
                 } elseif (empty($this->_id)) {
                     //ensure login and password are not empty
                     if (($key == 'login_adh' || $key == 'mdp_adh') && !isset($required[$key])) {
@@ -1144,6 +1146,11 @@ class Adherent
             }
         }
 
+        //password checks need data to be previously set
+        if (isset($values['mdp_adh'])) {
+            $this->validate('mdp_adh', $values['mdp_adh'], $values);
+        }
+
         // missing required fields?
         foreach ($required as $key => $val) {
             $prop = '_' . $this->fields[$key]['propname'];