Fix infinite loop with sign me

Added data-cfasync="false" for CloudFlare Rocketscript
This commit is contained in:
RainLoop Team 2014-05-21 23:49:27 +04:00
parent be77754286
commit b6a06d74a9
12 changed files with 787 additions and 751 deletions

View file

@ -1360,6 +1360,35 @@ class Actions
}
}
/**
* @param \RainLoop\Account $oAccount
*
* @throws \RainLoop\Exceptions\ClientException
*/
public function CheckMailConnection($oAccount)
{
try
{
$this->MailClient()
->Connect($oAccount->Domain()->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email())),
$oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure())
->Login($oAccount->IncLogin(), $oAccount->Password())
;
}
catch (\RainLoop\Exceptions\ClientException $oException)
{
throw $oException;
}
catch (\MailSo\Net\Exceptions\ConnectionException $oException)
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::ConnectionError, $oException);
}
catch (\Exception $oException)
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError, $oException);
}
}
/**
* @param string $sEmail
* @param string $sLogin
@ -1461,26 +1490,12 @@ class Actions
try
{
$this->MailClient()
->Connect($oAccount->Domain()->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email())),
$oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure())
->Login($oAccount->IncLogin(), $oAccount->Password())
;
}
catch (\RainLoop\Exceptions\ClientException $oException)
{
$this->loginErrorDelay();
throw $oException;
}
catch (\MailSo\Net\Exceptions\ConnectionException $oException)
{
$this->loginErrorDelay();
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::ConnectionError, $oException);
$this->CheckMailConnection($oAccount);
}
catch (\Exception $oException)
{
$this->loginErrorDelay();
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError, $oException);
throw $oException;
}
return $oAccount;
@ -1890,6 +1905,21 @@ class Actions
));
}
/**
* @param \RainLoop\Account $oAccount
*/
public function ClearSignMeData($oAccount)
{
if ($oAccount)
{
\RainLoop\Utils::ClearCookie(\RainLoop\Actions::AUTH_SIGN_ME_TOKEN_KEY);
$this->StorageProvider()->Clear(null,
\RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY,
'SignMe/UserToken/'.$oAccount->SignMeToken());
}
}
/**
* @return array
*/
@ -1898,11 +1928,7 @@ class Actions
$oAccount = $this->getAccountFromToken(false);
if ($oAccount && $oAccount->SignMe())
{
\RainLoop\Utils::ClearCookie(\RainLoop\Actions::AUTH_SIGN_ME_TOKEN_KEY);
$this->StorageProvider()->Clear(null,
\RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY,
'SignMe/UserToken/'.$oAccount->SignMeToken());
$this->ClearSignMeData($oAccount);
}
return $this->TrueResponse(__FUNCTION__);