Commit 85f5cb86 authored by Côme Chilliet's avatar Côme Chilliet

Merge branch '3710-support-users-with-no-password' into '1.4-dev'

Resolve "Support users with no password"

See merge request fusiondirectory/fd!603
parents 34bab926 fa625fe8
......@@ -182,25 +182,20 @@ class UserPasswordAttribute extends CompositeAttribute
$pw_storage = $config->get_cfg_value('passwordDefaultHash', 'ssha');
$locked = FALSE;
$password = '';
if ($istemplate && !empty($value)) {
if ($value == '%askme%') {
return ['%askme%', '', '', $value, $locked];
if (!empty($value)) {
if ($istemplate) {
if ($value == '%askme%') {
return ['%askme%', '', '', $value, ($locked ? 'TRUE' : 'FALSE')];
}
list($value, $password) = explode('|', $value, 2);
}
list($value, $password) = explode('|', $value, 2);
}
if (preg_match('/^{[^}]+}/', $value)) {
$tmp = passwordMethod::get_method($value);
if (is_object($tmp)) {
$pw_storage = $tmp->get_hash();
$locked = $tmp->is_locked('', $value);
}
} elseif ($value != '') {
$pw_storage = 'clear';
} elseif ($this->plugin->initially_was_account) {
$pw_storage = 'empty';
}
$locked = ($locked ? 'TRUE' : 'FALSE');
return [$pw_storage, $password, $password, $value, $locked];
return [$pw_storage, $password, $password, $value, ($locked ? 'TRUE' : 'FALSE')];
}
function writeValues (array $values)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment