sewPwdExpiration() sets date internally not 'now'

This commit is contained in:
Uwe Steinmann 2021-09-28 15:46:05 +02:00
parent b6a308e630
commit 39ec44cd41

View File

@ -76,10 +76,10 @@ class SeedDMS_Core_Role { /* {{{ */
* @param string|integer $id Id, login name, or email of user, depending
* on the 3rd parameter.
* @param object $dms instance of dms
* @param string $by search by [name|email]. If 'name' is passed, the method
* will check for the 4th paramater and also filter by email. If this
* parameter is left empty, the user will be search by its Id.
* @param string $email optional email address if searching for name
* @param string $by search by name. If 'name' is passed, the method
* will search by name instead of id. If this
* parameter is left empty, the role will be searched by its Id.
*
* @return object instance of class SeedDMS_Core_User
*/
public static function getInstance($id, $dms, $by='') { /* {{{ */
@ -631,10 +631,11 @@ class SeedDMS_Core_User { /* {{{ */
if(trim($newPwdExpiration) == '' || trim($newPwdExpiration) == 'never') {
$newPwdExpiration = null;
$queryStr = "UPDATE `tblUsers` SET `pwdExpiration` = NULL WHERE `id` = " . $this->_id;
} elseif(trim($newPwdExpiration) == 'now')
$queryStr = "UPDATE `tblUsers` SET `pwdExpiration` =".$db->qstr(date('Y-m-d H:i:s'))." WHERE `id` = " . $this->_id;
else
} else {
if(trim($newPwdExpiration) == 'now')
$newPwdExpiration = date('Y-m-d H:i:s');
$queryStr = "UPDATE `tblUsers` SET `pwdExpiration` =".$db->qstr($newPwdExpiration)." WHERE `id` = " . $this->_id;
}
$res = $db->getResult($queryStr);
if (!$res)
return false;