From 1dd592f81fc6fb7d3735f968567090090ff5a5b7 Mon Sep 17 00:00:00 2001 From: djmaze Date: Wed, 10 Nov 2021 15:18:44 +0100 Subject: [PATCH] Contact sync use Account password hash --- .../v/0.0.0/app/libraries/RainLoop/Actions/Contacts.php | 4 ++-- snappymail/v/0.0.0/app/libraries/RainLoop/Model/Account.php | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Contacts.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Contacts.php index b91bc2070..6e0d46eab 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Contacts.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Contacts.php @@ -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; diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Account.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Account.php index 5c104305a..e81d14f36 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Account.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Account.php @@ -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;