Contact sync use Account password hash

This commit is contained in:
djmaze 2021-11-10 15:18:44 +01:00
parent c13724fbbb
commit 1dd592f81f
2 changed files with 7 additions and 2 deletions

View file

@ -32,7 +32,7 @@ trait Contacts
\json_encode(array(
'Enable' => $bEnabled,
'User' => $sUser,
'Password' => $sPassword ? \SnappyMail\Crypt::Encrypt($sPassword, $oAccount->Password() ?: APP_SALT) : null,
'Password' => $sPassword ? \SnappyMail\Crypt::Encrypt($sPassword, $oAccount->PasswordHash()) : null,
'Url' => $sUrl
))
);
@ -253,7 +253,7 @@ trait Contacts
if ($aData['Password']) {
$aData['Password'] = \SnappyMail\Crypt::DecryptFromJSON(
$aData['Password'],
$oAccount->Password() ?: APP_SALT
$oAccount->PasswordHash()
);
}
return $aData;

View file

@ -114,6 +114,11 @@ class Account implements \JsonSerializable
return $this->IncPassword();
}
public function PasswordHash() : string
{
return \sha1($this->IncPassword() + APP_SALT, true);
}
public function ClientCert() : string
{
return $this->sClientCert;