From e66f06cda25e8cfbac476e6ff59af6d6053e1555 Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Mon, 6 Dec 2010 17:07:07 +0000 Subject: [PATCH] Internal: improved the user management API ChangePassword() SVN:trunk[1012] --- core/userrights.class.inc.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/core/userrights.class.inc.php b/core/userrights.class.inc.php index 7ef26d117..0cc726142 100644 --- a/core/userrights.class.inc.php +++ b/core/userrights.class.inc.php @@ -418,16 +418,25 @@ class UserRights } } - public static function ChangePassword($sCurrentPassword, $sNewPassword) + public static function ChangePassword($sOldPassword, $sNewPassword, $sName = '') { - if (!is_null(self::$m_oUser)) + if (empty($sName)) { - return self::$m_oUser->ChangePassword($sCurrentPassword, $sNewPassword); + $oUser = self::$m_oUser; } else + { + // find the id out of the login string + $oUser = self::FindUser($sName); + } + if (is_null($oUser)) { return false; } + else + { + return $oUser->ChangePassword($sOldPassword, $sNewPassword); + } } public static function Impersonate($sName, $sPassword)