mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 00:14:50 +03:00
Protect against multiple accounts on different tabs #892
This commit is contained in:
parent
c21817e5e0
commit
3396a3d791
2 changed files with 6 additions and 2 deletions
|
|
@ -14,7 +14,7 @@ class AdditionalAccount extends Account
|
|||
|
||||
public function Hash() : string
|
||||
{
|
||||
return \md5(parent::Hash() . $this->ParentEmail());
|
||||
return \sha1(parent::Hash() . $this->ParentEmail());
|
||||
}
|
||||
|
||||
public static function convertArray(array $aAccount) : array
|
||||
|
|
|
|||
|
|
@ -74,12 +74,16 @@ class Utils
|
|||
|
||||
public static function GetConnectionToken() : string
|
||||
{
|
||||
$oActions = \RainLoop\Api::Actions();
|
||||
$oAccount = $oActions->getAccountFromToken(false) ?: $oActions->getMainAccountFromToken(false);
|
||||
if ($oAccount) {
|
||||
return $oAccount->Hash();
|
||||
}
|
||||
$sToken = static::GetCookie(self::CONNECTION_TOKEN);
|
||||
if (!$sToken) {
|
||||
$sToken = \MailSo\Base\Utils::Sha1Rand(APP_SALT);
|
||||
static::SetCookie(self::CONNECTION_TOKEN, $sToken, \time() + 3600 * 24 * 30);
|
||||
}
|
||||
|
||||
return \sha1('Connection'.APP_SALT.$sToken.'Token'.APP_SALT);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue