mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-26 02:29:20 +03:00
Test login on account switching
This commit is contained in:
parent
9ba11c77eb
commit
4097e4e733
2 changed files with 12 additions and 9 deletions
|
|
@ -215,9 +215,8 @@ trait User
|
|||
$bMainCache = false;
|
||||
$bFilesCache = false;
|
||||
|
||||
$iOneDay1 = 60 * 60 * 23;
|
||||
$iOneDay2 = 60 * 60 * 25;
|
||||
$iOneDay3 = 60 * 60 * 30;
|
||||
$iOneDay1 = 3600 * 23;
|
||||
$iOneDay2 = 3600 * 25;
|
||||
|
||||
$sTimers = $this->StorageProvider()->Get(null,
|
||||
\RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, 'Cache/Timers', '');
|
||||
|
|
|
|||
|
|
@ -161,9 +161,9 @@ trait UserAuth
|
|||
$this->Http()->ServerNoCache();
|
||||
$oMainAccount = $this->getMainAccountFromToken(false);
|
||||
if ($sEmail && $oMainAccount && $this->GetCapa(false, \RainLoop\Enumerations\Capa::ADDITIONAL_ACCOUNTS, $oMainAccount)) {
|
||||
$oAccountToLogin = null;
|
||||
$oAccount = null;
|
||||
if ($oMainAccount->Email() === $sEmail) {
|
||||
$this->SetAdditionalAuthToken($oAccountToLogin);
|
||||
$this->SetAdditionalAuthToken($oAccount);
|
||||
return true;
|
||||
}
|
||||
$sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail);
|
||||
|
|
@ -171,16 +171,17 @@ trait UserAuth
|
|||
if (!isset($aAccounts[$sEmail])) {
|
||||
throw new ClientException(Notifications::AccountDoesNotExist);
|
||||
}
|
||||
$oAccountToLogin = AdditionalAccount::NewInstanceFromTokenArray(
|
||||
$oAccount = AdditionalAccount::NewInstanceFromTokenArray(
|
||||
$this, $aAccounts[$sEmail]
|
||||
);
|
||||
if (!$oAccountToLogin) {
|
||||
if (!$oAccount) {
|
||||
throw new ClientException(Notifications::AccountSwitchFailed);
|
||||
}
|
||||
|
||||
// $this->CheckMailConnection($oAccountToLogin);
|
||||
// Test the login
|
||||
$this->CheckMailConnection($oAccount);
|
||||
|
||||
$this->SetAdditionalAuthToken($oAccountToLogin);
|
||||
$this->SetAdditionalAuthToken($oAccount);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -248,9 +249,11 @@ trait UserAuth
|
|||
} else {
|
||||
$oMainAuthAccount && $this->StorageProvider()->Clear($oMainAuthAccount, StorageType::SESSION, $sToken);
|
||||
Utils::ClearCookie(Utils::SESSION_TOKEN);
|
||||
$this->SetSpecLogoutCustomMgsWithDeletion('Session gone');
|
||||
$this->Logout(true);
|
||||
}
|
||||
} else {
|
||||
$this->SetSpecLogoutCustomMgsWithDeletion('Session undefined');
|
||||
$this->Logout(true);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -265,6 +268,7 @@ trait UserAuth
|
|||
}
|
||||
|
||||
if ($this->oMainAuthAccount) {
|
||||
// Extend session cookie lifetime
|
||||
$this->StorageProvider()->Put($this->oMainAuthAccount, StorageType::SESSION, Utils::GetSessionToken(), 'true');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue