mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-05 07:27:04 +03:00
Fix infinite loop with sign me
Added data-cfasync="false" for CloudFlare Rocketscript
This commit is contained in:
parent
be77754286
commit
b6a06d74a9
12 changed files with 787 additions and 751 deletions
|
|
@ -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__);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -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>' : '')
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ class Social
|
|||
$sCheckToken = !empty($aParts[0]) ? $aParts[0] : '';
|
||||
$sCheckAuth = !empty($aParts[1]) ? $aParts[1] : '';
|
||||
}
|
||||
|
||||
|
||||
$sRedirectUrl = $this->oHttp->GetFullUrl().'?SocialGoogle';
|
||||
if (!$this->oHttp->HasQuery('code'))
|
||||
{
|
||||
|
|
@ -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>';
|
||||
}
|
||||
|
||||
|
|
@ -451,7 +451,7 @@ class Social
|
|||
try
|
||||
{
|
||||
$oAccount = $this->oActions->GetAccount();
|
||||
|
||||
|
||||
$oFacebook = $this->FacebookConnector($oAccount ? $oAccount : null);
|
||||
if ($oFacebook)
|
||||
{
|
||||
|
|
@ -537,7 +537,7 @@ class Social
|
|||
$aUserData = \RainLoop\Utils::DecodeKeyValues($sUserData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($aUserData && \is_array($aUserData) &&
|
||||
!empty($aUserData['Email']) &&
|
||||
!empty($aUserData['Login']) &&
|
||||
|
|
@ -547,7 +547,7 @@ class Social
|
|||
if ($oAccount instanceof \RainLoop\Account)
|
||||
{
|
||||
$this->oActions->AuthProcess($oAccount);
|
||||
|
||||
|
||||
$iErrorCode = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -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>';
|
||||
}
|
||||
|
||||
|
|
@ -729,7 +729,7 @@ class Social
|
|||
if ($oAccount instanceof \RainLoop\Account)
|
||||
{
|
||||
$this->oActions->AuthProcess($oAccount);
|
||||
|
||||
|
||||
$iErrorCode = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -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>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace RainLoop;
|
|||
class Utils
|
||||
{
|
||||
static $Cookies = null;
|
||||
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -34,7 +34,7 @@ class Utils
|
|||
{
|
||||
return \MailSo\Base\Crypt::XxteaDecrypt($sEncriptedString, $sKey);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $aValues
|
||||
* @param string $sCustomKey = ''
|
||||
|
|
@ -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>';
|
||||
}
|
||||
|
||||
|
|
@ -366,12 +366,12 @@ class Utils
|
|||
}
|
||||
|
||||
public static function CustomBaseConvert($sNumberInput, $sFromBaseInput = '0123456789', $sToBaseInput = '0123456789')
|
||||
{
|
||||
{
|
||||
if ($sFromBaseInput === $sToBaseInput)
|
||||
{
|
||||
return $sNumberInput;
|
||||
}
|
||||
|
||||
|
||||
$mFromBase = \str_split($sFromBaseInput, 1);
|
||||
$mToBase = \str_split($sToBaseInput, 1);
|
||||
$aNumber = \str_split($sNumberInput, 1);
|
||||
|
|
@ -387,10 +387,10 @@ class Utils
|
|||
{
|
||||
$mRetVal = \bcadd($mRetVal, \bcmul(\array_search($aNumber[$iIndex - 1], $mFromBase), \bcpow($iFromLen, $numberLen - $iIndex)));
|
||||
}
|
||||
|
||||
|
||||
return $mRetVal;
|
||||
}
|
||||
|
||||
|
||||
if ($sFromBaseInput != '0123456789')
|
||||
{
|
||||
$sBase10 = \RainLoop\Utils::CustomBaseConvert($sNumberInput, $sFromBaseInput, '0123456789');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue