empty password in csv file will not override an existing password

This commit is contained in:
Uwe Steinmann 2023-03-04 10:09:05 +01:00
parent 9e36d82873
commit 0e712c1554

View File

@ -45,7 +45,8 @@ function renderBooleanData($colname, $objdata) { /* {{{ */
} /* }}} */
function getPasswordPlainData($colname, $coldata, $objdata) { /* {{{ */
$objdata['passenc'] = seed_pass_hash($coldata);
/* Setting 'passenc' to null will not update the password */
$objdata['passenc'] = $coldata ? seed_pass_hash($coldata) : null;
return $objdata;
} /* }}} */
@ -245,7 +246,7 @@ if (isset($_FILES['userdata']) && $_FILES['userdata']['error'] == 0) {
if($makeupdate)
$eu->setEmail($u['email']);
}
if(isset($u['passenc']) && $u['passenc'] != $eu->getPwd()) {
if(isset($u['passenc']) && !is_null($u['passenc']) && $u['passenc'] != $eu->getPwd()) {
$log[$uhash][] = array('id'=>$eu->getLogin(), 'type'=>'success', 'msg'=> "Encrypted password of user updated. '".$u['passenc']."' != '".$eu->getPwd()."'");
if($makeupdate)
$eu->setPwd($u['passenc']);