Skip to content

Commit 925e1fc

Browse files
Fix install issue with empty password
1 parent acae03e commit 925e1fc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

classes/admin_setting_configpasswordhashed.php

+8
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ public function write_setting($data) {
6363
if (empty($data)) {
6464
// Password field is empty so just reuse existing hash.
6565
$password = $this->config_read($this->name);
66+
67+
// If it is null then it is a fresh install so save an empty string.
68+
if ($password === null) {
69+
$password = '';
70+
}
6671
} else {
6772
// Hash new password.
6873
$password = password_hash($data, PASSWORD_DEFAULT);
@@ -76,6 +81,9 @@ public function write_setting($data) {
7681
* @return mixed true if ok string if error found
7782
*/
7883
public function validate($data) {
84+
if ($data === '') {
85+
return true;
86+
}
7987
if (empty($data) || (is_string($data) && (strlen($data) >= $this->minlength))) {
8088
return true;
8189
}

0 commit comments

Comments
 (0)