We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent acae03e commit 925e1fcCopy full SHA for 925e1fc
classes/admin_setting_configpasswordhashed.php
@@ -63,6 +63,11 @@ public function write_setting($data) {
63
if (empty($data)) {
64
// Password field is empty so just reuse existing hash.
65
$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
+ }
71
} else {
72
// Hash new password.
73
$password = password_hash($data, PASSWORD_DEFAULT);
@@ -76,6 +81,9 @@ public function write_setting($data) {
76
81
* @return mixed true if ok string if error found
77
82
*/
78
83
public function validate($data) {
84
+ if ($data === '') {
85
+ return true;
86
79
87
if (empty($data) || (is_string($data) && (strlen($data) >= $this->minlength))) {
80
88
return true;
89
}
0 commit comments