Skip to content

Commit

Permalink
Fixed issue #9430: AuditLog: Password logged as modified every time a…
Browse files Browse the repository at this point in the history
…n user is modified

Dev: Before, fake hashes were saved. After this patch, we save a descriptive message
  • Loading branch information
Aestu committed Dec 29, 2014
1 parent 07a060a commit 25c0231
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions plugins/AuditLog/AuditLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,24 @@ public function beforeUserSave()
$sAction='create';
$aOldValues=array();
// Indicate the password has changed but assign fake hash
$aNewValues['password']=hash('md5','67890');
$aNewValues['password']='*MASKED*PASSWORD*';
}
else
{
$oOldUser=$this->api->getUser($oUserData->uid);
$sAction='update';
$aOldValues=$oOldUser->getAttributes();

// Postgres delivers bytea fields as streams
if (gettype($aOldValues['password'])=='resource')
{
$aOldValues['password'] = stream_get_contents($aOldValues['password']);
}
// If the password has changed then indicate that it has changed but assign fake hashes
if ($aNewValues['password']!=$aOldValues['password'])
{
$aOldValues['password']=hash('md5','12345');
$aNewValues['password']=hash('md5','67890');
$aOldValues['password']='*MASKED*OLD*PASSWORD*';
$aNewValues['password']='*MASKED*NEW*PASSWORD*';
};
}

Expand Down

0 comments on commit 25c0231

Please sign in to comment.