diff options
| author | David Siegfried <david.siegfried@uni-vechta.de> | 2022-05-12 13:12:26 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2022-05-12 13:12:26 +0000 |
| commit | 3ac58fb142e3b17987ac6b075a523fb2a09aa51f (patch) | |
| tree | c86928fbe2286026bd2158c0d26870fd3145ebf3 /lib/admissionrules | |
| parent | 6d0567218eb3f584889d5b3fadc6fb6c8b5a7b56 (diff) | |
fix editing passwordadmission, closes #1045
Closes #1045
Merge request studip/studip!613
Diffstat (limited to 'lib/admissionrules')
| -rw-r--r-- | lib/admissionrules/passwordadmission/PasswordAdmission.class.php | 15 | ||||
| -rw-r--r-- | lib/admissionrules/passwordadmission/templates/configure.php | 7 |
2 files changed, 13 insertions, 9 deletions
diff --git a/lib/admissionrules/passwordadmission/PasswordAdmission.class.php b/lib/admissionrules/passwordadmission/PasswordAdmission.class.php index c0aa970..6a99066 100644 --- a/lib/admissionrules/passwordadmission/PasswordAdmission.class.php +++ b/lib/admissionrules/passwordadmission/PasswordAdmission.class.php @@ -19,20 +19,20 @@ require_once 'vendor/phpass/PasswordHash.php'; class PasswordAdmission extends AdmissionRule { - // --- ATTRIBUTES --- /* * Password hasher (phpass library) */ - var $hasher = null; + public $hasher = null; /* * Crypted password. */ - var $password = ''; + public $password = ''; // --- OPERATIONS --- + public $new = false; /** * Standard constructor. * @@ -48,6 +48,7 @@ class PasswordAdmission extends AdmissionRule $this->load(); } else { $this->id = $this->generateId('passwordadmissions'); + $this->new = true; } } @@ -173,7 +174,9 @@ class PasswordAdmission extends AdmissionRule */ public function setAllData($data) { parent::setAllData($data); - $this->setPassword($data['password1']); + if ($this->new || $data['password1'] !== '') { + $this->setPassword($data['password1']); + } return $this; } @@ -227,10 +230,10 @@ class PasswordAdmission extends AdmissionRule public function validate($data) { $errors = parent::validate($data); - if (!$data['password1']) { + if ($data['password1'] === '' && $this->new) { $errors[] = _('Das Passwort darf nicht leer sein.'); } - if ($data['password1'] != $data['password2']) { + if ($data['password1'] !== $data['password2']) { $errors[] = _('Das Passwort stimmt nicht mit der Wiederholung überein.'); } return $errors; diff --git a/lib/admissionrules/passwordadmission/templates/configure.php b/lib/admissionrules/passwordadmission/templates/configure.php index e9ccac1..4642dec 100644 --- a/lib/admissionrules/passwordadmission/templates/configure.php +++ b/lib/admissionrules/passwordadmission/templates/configure.php @@ -5,10 +5,11 @@ </label> <label> <?= _('Zugangspasswort') ?>: - <input type="password" name="password1" size="25" max="40" value="<?= htmlReady($rule->getPassword()) ?>" required> + <input type="password" name="password1" size="25" max="40" + value="<?= htmlReady(Request::get('password1')) ?>" <?= $rule->new ? 'required' : ''?>> </label> -<br/> <label> <?= _('Passwort wiederholen') ?>: - <input type="password" name="password2" size="25" max="40" value="<?= htmlReady($rule->getPassword()) ?>" required> + <input type="password" name="password2" size="25" max="40" + value="<?= htmlReady(Request::get('password2')) ?>" <?= $rule->new ? 'required' : ''?>> </label> |
