Added "[labs] imap_show_login_alert" setting

Small fixes
This commit is contained in:
RainLoop Team 2015-01-08 18:00:03 +04:00
parent f749d77fff
commit 43d1794423
81 changed files with 132 additions and 48 deletions

View file

@ -128,6 +128,17 @@
margin-top: -2px;
margin-left: -2px;
}
&.white {
border-color: #fff;
border-top-color: #999;
&.animated {
border-color: transparent;
border-top-color: #fff;
}
}
}
html.no-cssanimations .icon-spinner {

View file

@ -75,6 +75,14 @@
this.submitRequest = ko.observable(false);
this.submitError = ko.observable('');
this.submitErrorAddidional = ko.observable('');
this.submitError.subscribe(function (sValue) {
if ('' === sValue)
{
this.submitErrorAddidional('');
}
}, this);
this.allowLanguagesOnLogin = Data.allowLanguagesOnLogin;
@ -178,6 +186,13 @@
{
this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
}
else
{
if (oData.ErrorMessageAdditional)
{
this.submitErrorAddidional(oData.ErrorMessageAdditional);
}
}
}
else
{

View file

@ -11,7 +11,7 @@ if (!\defined('RAINLOOP_APP_LIBRARIES_PATH'))
if (!defined('RL_BACKWARD_CAPABILITY'))
{
\define('RL_BACKWARD_CAPABILITY', true);
include_once RAINLOOP_APP_PATH.'src/RainLoop/Common/BackwardCapability/Account.php';
include_once RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/Common/BackwardCapability/Account.php';
}
/**
@ -19,49 +19,45 @@ if (!\defined('RAINLOOP_APP_LIBRARIES_PATH'))
*
* @return mixed
*/
function RainLoopSplAutoloadRegisterFunction($sClassName)
function rainLoopSplAutoloadNamespaces()
{
if (0 === \strpos($sClassName, 'RainLoop') && false !== \strpos($sClassName, '\\'))
return RAINLOOP_INCLUDE_AS_API_DEF ? array('RainLoop') :
array('RainLoop', 'Facebook', 'GuzzleHttp', 'Symfony', 'PHPThumb', 'Sabre');
}
/**
* @param string $sClassName
*
* @return mixed
*/
function rainLoopSplAutoloadRegisterFunction($sClassName)
{
if ($sClassName && '\\' === $sClassName[0])
{
return include RAINLOOP_APP_PATH.'src/RainLoop/'.\str_replace('\\', '/', \substr($sClassName, 9)).'.php';
$sClassName = \substr($sClassName, 1);
}
else if (!RAINLOOP_INCLUDE_AS_API_DEF)
foreach (rainLoopSplAutoloadNamespaces() as $sNamespaceName)
{
if (0 === \strpos($sClassName, 'Facebook') && false !== \strpos($sClassName, '\\'))
if (0 === \strpos($sClassName, $sNamespaceName.'\\'))
{
return include RAINLOOP_APP_LIBRARIES_PATH.'Facebook/'.\str_replace('\\', '/', \substr($sClassName, 9)).'.php';
}
else if (0 === \strpos($sClassName, 'GuzzleHttp') && false !== \strpos($sClassName, '\\'))
{
return include RAINLOOP_APP_LIBRARIES_PATH.'GuzzleHttp/'.\str_replace('\\', '/', \substr($sClassName, 11)).'.php';
}
else if (0 === \strpos($sClassName, 'Symfony') && false !== \strpos($sClassName, '\\'))
{
return include RAINLOOP_APP_LIBRARIES_PATH.'Symfony/'.\str_replace('\\', '/', \substr($sClassName, 8)).'.php';
}
else if (0 === \strpos($sClassName, 'PHPThumb') && false !== \strpos($sClassName, '\\'))
{
return include RAINLOOP_APP_LIBRARIES_PATH.'PHPThumb/'.\str_replace('\\', '/', \substr($sClassName, 9)).'.php';
}
else if (0 === \strpos($sClassName, 'Sabre') && false !== \strpos($sClassName, '\\'))
{
if (!RAINLOOP_MB_SUPPORTED && !defined('RL_MB_FIXED'))
if ('Sabre' === $sNamespaceName && !RAINLOOP_MB_SUPPORTED && !defined('RL_MB_FIXED'))
{
\define('RL_MB_FIXED', true);
include_once RAINLOOP_APP_PATH.'src/RainLoop/Common/MbStringFix.php';
include_once RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/Common/MbStringFix.php';
}
return include RAINLOOP_APP_LIBRARIES_PATH.'Sabre/'.\str_replace('\\', '/', \substr($sClassName, 6)).'.php';
return include RAINLOOP_APP_LIBRARIES_PATH.\strtr($sClassName, '\\', '/').'.php';
}
}
return false;
}
\spl_autoload_register('RainLoopSplAutoloadRegisterFunction', false);
\spl_autoload_register('rainLoopSplAutoloadRegisterFunction', false);
}
if (\class_exists('RainLoop\Service'))
if (\class_exists('RainLoop\Api'))
{
if (!\class_exists('MailSo\Version'))
{
@ -90,7 +86,7 @@ if (\class_exists('RainLoop\Service'))
}
}
}
else if (\function_exists('RainLoopSplAutoloadRegisterFunction'))
else if (\function_exists('rainLoopSplAutoloadRegisterFunction'))
{
\spl_autoload_unregister('RainLoopSplAutoloadRegisterFunction');
\spl_autoload_unregister('rainLoopSplAutoloadRegisterFunction');
}

View file

@ -16,4 +16,22 @@ namespace MailSo\Imap\Exceptions;
* @package Imap
* @subpackage Exceptions
*/
class NegativeResponseException extends \MailSo\Imap\Exceptions\ResponseException {}
class NegativeResponseException extends \MailSo\Imap\Exceptions\ResponseException
{
/**
* @return string
*/
public function getAlertFromStatus()
{
$sResult = '';
$oResponse = $this->GetLastResponse();
if ($oResponse && $oResponse->IsStatusResponse && !empty($oResponse->HumanReadable) &&
isset($oResponse->OptionalResponse[0]) && 'ALERT' === $oResponse->OptionalResponse[0])
{
$sResult = $oResponse->HumanReadable;
}
return $sResult;
}
}

View file

@ -1525,6 +1525,18 @@ class Actions
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::ConnectionError, $oException);
}
catch (\MailSo\Imap\Exceptions\LoginBadCredentialsException $oException)
{
if ($this->Config()->Get('labs', 'imap_show_login_alert', true))
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError,
$oException, $oException->getAlertFromStatus());
}
else
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError, $oException);
}
}
catch (\Exception $oException)
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError, $oException);
@ -7739,10 +7751,11 @@ class Actions
* @param string $sActionName
* @param int $iErrorCode = null
* @param string $sErrorMessage = null
* @param string $sAdditionalErrorMessage = null
*
* @return array
*/
public function FalseResponse($sActionName, $iErrorCode = null, $sErrorMessage = null)
public function FalseResponse($sActionName, $iErrorCode = null, $sErrorMessage = null, $sAdditionalErrorMessage = null)
{
$mResult = false;
$this->Plugins()
@ -7755,6 +7768,7 @@ class Actions
{
$aAdditionalParams['ErrorCode'] = (int) $iErrorCode;
$aAdditionalParams['ErrorMessage'] = null === $sErrorMessage ? '' : (string) $sErrorMessage;
$aAdditionalParams['ErrorMessageAdditional'] = null === $sAdditionalErrorMessage ? '' : (string) $sAdditionalErrorMessage;
}
$aResponseItem = $this->mainDefaultResponse($sActionName, $mResult, $aAdditionalParams);
@ -7773,15 +7787,23 @@ class Actions
{
$iErrorCode = null;
$sErrorMessage = null;
$sErrorMessageAdditional = null;
if ($oException instanceof \RainLoop\Exceptions\ClientException)
{
$iErrorCode = $oException->getCode();
$sErrorMessage = null;
if ($iErrorCode === \RainLoop\Notifications::ClientViewError)
{
$sErrorMessage = $oException->getMessage();
}
$sErrorMessageAdditional = $oException->getAdditionalMessage();
if (empty($sErrorMessageAdditional))
{
$sErrorMessageAdditional = null;
}
}
else
{
@ -7799,7 +7821,7 @@ class Actions
$this->Logger()->WriteException($oException);
}
return $this->FalseResponse($sActionName, $iErrorCode, $sErrorMessage);
return $this->FalseResponse($sActionName, $iErrorCode, $sErrorMessage, $sErrorMessageAdditional);
}
/**

View file

@ -267,6 +267,7 @@ Enables caching in the system'),
'imap_message_list_date_filter' => array(0),
'imap_large_thread_limit' => array(100),
'imap_folder_list_limit' => array(200),
'imap_show_login_alert' => array(true),
'smtp_show_server_errors' => array(false),
'curl_proxy' => array(''),
'curl_proxy_auth' => array(''),

View file

@ -0,0 +1,32 @@
<?php
namespace RainLoop\Exceptions;
/**
* @category RainLoop
* @package Exceptions
*/
class ClientException extends Exception
{
/**
*
* @var string
*/
private $sAdditionalMessage;
public function __construct($iCode, $oPrevious = null, $sAdditionalMessage = '')
{
parent::__construct(\RainLoop\Notifications::GetNotificationsMessage($iCode, $oPrevious),
$iCode, $oPrevious);
$this->sAdditionalMessage = $sAdditionalMessage;
}
/**
* @return string
*/
public function getAdditionalMessage()
{
return $this->sAdditionalMessage;
}
}

View file

@ -1,15 +0,0 @@
<?php
namespace RainLoop\Exceptions;
/**
* @category RainLoop
* @package Exceptions
*/
class ClientException extends Exception
{
public function __construct($iCode, $oPrevious = null)
{
parent::__construct(\RainLoop\Notifications::GetNotificationsMessage($iCode, $oPrevious), $iCode, $oPrevious);
}
}

View file

@ -15,6 +15,10 @@
<div class="alert alertError" data-bind="visible: '' !== submitError()">
<button type="button" class="close" data-bind="click: function () { submitError('') }">&times;</button>
<span data-bind="text: submitError"></span>
<div data-bind="visible: '' !== submitErrorAddidional()">
<br />
<span data-bind="text: submitErrorAddidional"></span>
</div>
</div>
<form class="wrapper loginForm thm-login" action="#/" data-bind="submit: submitForm">
{{INCLUDE/TopControlGroup/PLACE}}

View file

@ -24,7 +24,7 @@
</div>
<div class="modal-footer">
<a class="btn btn-danger buttonClear" data-bind="command: clearCommand">
<i class="icon-fire" data-bind="css: {'icon-fire': !clearingProcess(), 'icon-spinner animated': clearingProcess()}" ></i>
<i class="icon-fire" data-bind="css: {'icon-fire': !clearingProcess(), 'icon-spinner animated white': clearingProcess()}" ></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="POPUPS_CLEAR_FOLDER/BUTTON_CLEAR"></span>
</a>