From add540c4762c6aed6845002a2190212f2d210fc4 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 28 Jul 2020 12:53:39 +0200 Subject: [PATCH] plain/encrypted password can be imported --- op/op.ImportUsers.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/op/op.ImportUsers.php b/op/op.ImportUsers.php index 68c19d842..aa52e002b 100644 --- a/op/op.ImportUsers.php +++ b/op/op.ImportUsers.php @@ -31,6 +31,11 @@ function getBaseData($colname, $coldata, $objdata) { /* {{{ */ return $objdata; } /* }}} */ +function getPasswordPlainData($colname, $coldata, $objdata) { /* {{{ */ + $objdata[$colname] = $coldata; + return $objdata; +} /* }}} */ + function getQuotaData($colname, $coldata, $objdata) { /* {{{ */ $objdata[$colname] = SeedDMS_Core_File::parse_filesize($coldata); return $objdata; @@ -98,7 +103,9 @@ if (isset($_FILES['userdata']) && $_FILES['userdata']['error'] == 0) { $colmap[$i] = array("getFolderData", $colname); } elseif(in_array($colname, array('quota'))) { $colmap[$i] = array("getQuotaData", $colname); - } elseif(in_array($colname, array('login', 'name', 'email', 'comment', 'group'))) { + } elseif(in_array($colname, array('password'))) { + $colmap[$i] = array("getPasswordPlainData", $colname); + } elseif(in_array($colname, array('login', 'name', 'passenc', 'email', 'comment', 'group'))) { $colmap[$i] = array("getBaseData", $colname); } elseif(substr($colname, 0, 5) == 'attr:') { $kk = explode(':', $colname, 2); @@ -141,6 +148,11 @@ if (isset($_FILES['userdata']) && $_FILES['userdata']['error'] == 0) { if($makeupdate) $eu->setEmail($u['email']); } + if(isset($u['passenc']) && $u['passenc'] != $eu->getPwd()) { + $log[] = array('id'=>$eu->getLogin(), 'type'=>'success', 'msg'=> "Encrypted password of user updated. '".$u['passenc']."' != '".$eu->getPwd()."'"); + if($makeupdate) + $eu->setPwd($u['passenc']); + } if(isset($u['comment']) && $u['comment'] != $eu->getComment()) { $log[] = array('id'=>$eu->getLogin(), 'type'=>'success', 'msg'=> "Comment of user updated. '".$u['comment']."' != '".$eu->getComment()."'"); if($makeupdate)