Fixed bug #102: allow users to change their password.

SVN:trunk[532]
This commit is contained in:
Denis Flaven
2010-07-02 11:23:59 +00:00
parent 75c1287ad1
commit aa3357fe78
8 changed files with 170 additions and 4 deletions

View File

@@ -304,6 +304,30 @@ class UserRightsMatrix extends UserRightsAddOnAPI
// todo: throw an exception?
return false;
}
public function CanChangePassword()
{
return true;
}
public function ChangePassword($iUserId, $sOldPassword, $sNewPassword)
{
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT UserRightsMatrixUsers WHERE userid = $iUserId"));
if ($oSet->Count() < 1)
{
return false;
}
$oLogin = $oSet->Fetch();
if ($oLogin->Get('password') == $sOldPassword)
{
$oLogin->Set('password', $sNewPassword);
$oLogin->DBUpdate();
return true;
}
return false;
}
public function GetUserId($sUserName)
{