We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2e89ed1 commit d30f95bCopy full SHA for d30f95b
classes/admin_setting_configpasswordhashed.php
@@ -74,6 +74,11 @@ public function write_setting($data) {
74
if (empty($data)) {
75
// Password field is empty so just reuse existing hash.
76
$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
+ }
82
} else {
83
// Hash new password.
84
$password = password_hash($data, PASSWORD_DEFAULT);
@@ -87,6 +92,9 @@ public function write_setting($data) {
87
92
* @return mixed true if ok string if error found
88
93
*/
89
94
public function validate($data) {
95
+ if ($data === '') {
96
+ return true;
97
90
98
if (empty($data) || (is_string($data) && (strlen($data) >= $this->minlength))) {
91
99
return true;
100
}
0 commit comments