فهرست منبع

Internal: improved the user management API ChangePassword()

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1012 a333f486-631f-4898-b8df-5754b55c2be0
romainq 14 سال پیش
والد
کامیت
2e3de1c4b5
1فایلهای تغییر یافته به همراه12 افزوده شده و 3 حذف شده
  1. 12 3
      core/userrights.class.inc.php

+ 12 - 3
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)