Skip to content

Commit d30f95b

Browse files
Fix install issue with empty password
1 parent 2e89ed1 commit d30f95b

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
@@ -74,6 +74,11 @@ public function write_setting($data) {
7474
if (empty($data)) {
7575
// Password field is empty so just reuse existing hash.
7676
$password = $this->config_read($this->name);
77+
78+
// If it is null then it is a fresh install so save an empty string.
79+
if ($password === null) {
80+
$password = '';
81+
}
7782
} else {
7883
// Hash new password.
7984
$password = password_hash($data, PASSWORD_DEFAULT);
@@ -87,6 +92,9 @@ public function write_setting($data) {
8792
* @return mixed true if ok string if error found
8893
*/
8994
public function validate($data) {
95+
if ($data === '') {
96+
return true;
97+
}
9098
if (empty($data) || (is_string($data) && (strlen($data) >= $this->minlength))) {
9199
return true;
92100
}

0 commit comments

Comments
 (0)