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

@ -2,7 +2,7 @@
"name": "RainLoop",
"title": "RainLoop Webmail",
"version": "1.6.6",
"release": "929",
"release": "930",
"description": "Simple, modern & fast web-based email client",
"homepage": "http://rainloop.net",
"main": "Gruntfile.js",

View file

@ -119,7 +119,7 @@ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
if ($error) {
$errorpart = "&error=" . $error;
}
return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
return '<script type="text/javascript" data-cfasync="false" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
<noscript>
<iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>

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__);

View file

@ -267,7 +267,7 @@ class Manager
if (file_exists($sFile))
{
$sTemplateName = substr(basename($sFile), 0, -5);
$sResult .= '<script id="'.preg_replace('/[^a-zA-Z0-9]/', '', $sTemplateName).'" type="text/html">'.
$sResult .= '<script id="'.preg_replace('/[^a-zA-Z0-9]/', '', $sTemplateName).'" type="text/html" data-cfasync="false">'.
$this->Actions()->ProcessTemplate($sTemplateName, file_get_contents($sFile)).'</script>';
}
}

View file

@ -994,8 +994,18 @@ class ServiceActions
$oAccount = $this->oActions->GetAccountFromSignMeToken();
if ($oAccount)
{
$this->oActions->AuthProcess($oAccount);
$sAuthAccountHash = $this->oActions->GetSpecAuthToken();
try
{
$this->oActions->CheckMailConnection($oAccount);
$this->oActions->AuthProcess($oAccount);
$sAuthAccountHash = $this->oActions->GetSpecAuthToken();
}
catch (\Exception $oException)
{
$this->oActions->ClearSignMeData($oAccount);
}
}
}
@ -1021,7 +1031,7 @@ class ServiceActions
$this->oActions->Plugins()->CompileTemplate($bAdmin);
return
($bWrapByScriptTag ? '<script type="text/javascript">' : '').
($bWrapByScriptTag ? '<script type="text/javascript" data-cfasync="false">' : '').
'window.rainloopTEMPLATES='.\MailSo\Base\Utils::Php2js(array($sHtml)).';'.
($bWrapByScriptTag ? '</script>' : '')
;
@ -1064,7 +1074,7 @@ class ServiceActions
$sResult = empty($sLangJs) ? 'null' : '{'.\substr($sLangJs, 0, -1).'}';
return
($bWrapByScriptTag ? '<script type="text/javascript">' : '').
($bWrapByScriptTag ? '<script type="text/javascript" data-cfasync="false">' : '').
'window.rainloopI18N='.$sResult.';'.$sMoment.
($bWrapByScriptTag ? '</script>' : '')
;
@ -1079,7 +1089,7 @@ class ServiceActions
private function compileAppData($aAppData, $bWrapByScriptTag = true)
{
return
($bWrapByScriptTag ? '<script>' : '').
($bWrapByScriptTag ? '<script type="text/javascript" data-cfasync="false">' : '').
'window.rainloopAppData='.\json_encode($aAppData).';'.
'if(window.__rlah_set){__rlah_set()};'.
($bWrapByScriptTag ? '</script>' : '')

View file

@ -415,7 +415,7 @@ class Social
@\header('Content-Type: text/html; charset=utf-8');
$sCallBackType = $bLogin ? '_login' : '';
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_google'.$sCallBackType.'_service';
$sResult = '<script>opener && opener.'.$sConnectionFunc.' && opener.'.
$sResult = '<script type="text/javascript" data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
}
@ -580,7 +580,7 @@ class Social
@\header('Content-Type: text/html; charset=utf-8');
$sCallBackType = $bLogin ? '_login' : '';
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_facebook'.$sCallBackType.'_service';
$sResult = '<script>opener && opener.'.$sConnectionFunc.' && opener.'.
$sResult = '<script type="text/javascript" data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
}
@ -778,7 +778,7 @@ class Social
@\header('Content-Type: text/html; charset=utf-8');
$sCallBackType = $bLogin ? '_login' : '';
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_twitter'.$sCallBackType.'_service';
$sResult = '<script>opener && opener.'.$sConnectionFunc.' && opener.'.
$sResult = '<script type="text/javascript" data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
}

View file

@ -258,7 +258,7 @@ class Utils
foreach ($aList as $sName)
{
$sTemplateName = \substr($sName, 0, -5);
$sResult .= '<script id="'.\preg_replace('/[^a-zA-Z0-9]/', '', $sTemplateName).'" type="text/html">'.
$sResult .= '<script id="'.\preg_replace('/[^a-zA-Z0-9]/', '', $sTemplateName).'" type="text/html" data-cfasync="false">'.
$oAction->ProcessTemplate($sTemplateName, \file_get_contents($sDirName.'/'.$sName)).'</script>';
}

View file

@ -13,7 +13,7 @@
<![endif]-->
<script type="text/javascript">
function __fIncludeScr(sSrc) {
document.write(unescape('%3Csc' + 'ript type="text/jav' + 'ascr' + 'ipt" sr' + 'c="' + sSrc + '"%3E%3C/' + 'scr' + 'ipt%3E'));
document.write(unescape('%3Csc' + 'ript data-cfasync="false" type="text/jav' + 'ascr' + 'ipt" sr' + 'c="' + sSrc + '"%3E%3C/' + 'scr' + 'ipt%3E'));
}
if (!navigator || !navigator.cookieEnabled) {
@ -28,11 +28,11 @@
<link rel="apple-touch-icon" href="{{BaseAppAppleTouchFile}}" type="image/png" />
<link type="text/css" rel="stylesheet" href="{{BaseAppMainCssLink}}" />
<link type="text/css" rel="stylesheet" id="rlThemeLink" />
<script type="text/javascript">{{BaseAppBootScriptSource}}</script>
<script type="text/javascript">
<script type="text/javascript" data-cfasync="false">{{BaseAppBootScriptSource}}</script>
<script type="text/javascript" data-cfasync="false">
__fIncludeScr('{{BaseAppDataScriptLink}}' + (window.__rlah ? window.__rlah() || '0' : '0') + '/{{BaseRandHash}}/');
</script>
<script type="text/javascript">
<script type="text/javascript" data-cfasync="false">
if (window.rainloopAppData && window.rainloopAppData['NewThemeLink']) {
document.getElementById('rlThemeLink').href = window.rainloopAppData['NewThemeLink'];
}
@ -48,7 +48,7 @@
<div class="e-bounce bounce3"></div>
</div>
</div>
<script type="text/javascript">
<script type="text/javascript" data-cfasync="false">
var oE = document.getElementById('rl-loading');
if (oE) {
oE.style.opacity = 0;
@ -71,25 +71,25 @@
</div>
<div id="rl-templates"></div>
<div id="rl-hidden"></div>
<script type="text/javascript" src="{{BaseAppLibsScriptLink}}"></script>
<script type="text/javascript" src="{{BaseAppEditorScriptLink}}"></script>
<script type="text/javascript">
<script type="text/javascript" src="{{BaseAppLibsScriptLink}}" data-cfasync="false"></script>
<script type="text/javascript" src="{{BaseAppEditorScriptLink}}" data-cfasync="false"></script>
<script type="text/javascript" data-cfasync="false">
if (window.rainloopAppData && window.rainloopAppData['TemplatesLink']) {
__fIncludeScr(window.rainloopAppData['TemplatesLink']);
}
</script>
<script type="text/javascript">
<script type="text/javascript" data-cfasync="false">
if (window.rainloopAppData && window.rainloopAppData['LangLink']) {
__fIncludeScr(window.rainloopAppData['LangLink']);
}
</script>
<script type="text/javascript" src="{{BaseAppMainScriptLink}}"></script>
<script type="text/javascript">
<script type="text/javascript" src="{{BaseAppMainScriptLink}}" data-cfasync="false"></script>
<script type="text/javascript" data-cfasync="false">
if (window.rainloopAppData && window.rainloopAppData['PluginsLink']) {
__fIncludeScr(window.rainloopAppData['PluginsLink']);
}
</script>
<script type="text/javascript">
<script type="text/javascript" data-cfasync="false">
function __showError() {
var oR = document.getElementById('rl-loading'),
oL = document.getElementById('rl-loading-error');

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long