mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 21:49:21 +03:00
Small fixes
This commit is contained in:
parent
3246b2c81f
commit
66c3307291
14 changed files with 105 additions and 31 deletions
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
Consts = require('Common/Consts'),
|
||||
Enums = require('Common/Enums'),
|
||||
Globals = require('Common/Globals'),
|
||||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
Plugins = require('Common/Plugins'),
|
||||
|
|
@ -86,7 +87,7 @@
|
|||
'global': true
|
||||
}).always(function (oData, sTextStatus) {
|
||||
|
||||
var bCached = false, sType = Enums.StorageResultType.Error;
|
||||
var bCached = false, oErrorData = null, sType = Enums.StorageResultType.Error;
|
||||
if (oData && oData['Time'])
|
||||
{
|
||||
bCached = Utils.pInt(oData['Time']) > Utils.microtime() - iStart;
|
||||
|
|
@ -115,15 +116,18 @@
|
|||
}
|
||||
else if (oData && oData.Action)
|
||||
{
|
||||
oErrorData = oData;
|
||||
oDeferred.reject(oData.ErrorCode ? oData.ErrorCode : Enums.Notification.AjaxFalse);
|
||||
}
|
||||
else
|
||||
{
|
||||
oErrorData = oData;
|
||||
oDeferred.reject(Enums.Notification.AjaxParse);
|
||||
}
|
||||
}
|
||||
else if ('timeout' === sTextStatus)
|
||||
{
|
||||
oErrorData = oData;
|
||||
oDeferred.reject(Enums.Notification.AjaxTimeout);
|
||||
}
|
||||
else if ('abort' === sTextStatus)
|
||||
|
|
@ -135,6 +139,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
oErrorData = oData;
|
||||
oDeferred.reject(Enums.Notification.AjaxParse);
|
||||
}
|
||||
|
||||
|
|
@ -145,6 +150,45 @@
|
|||
}
|
||||
|
||||
self.setTrigger(fTrigger, false);
|
||||
|
||||
if (oErrorData)
|
||||
{
|
||||
if (-1 < Utils.inArray(oErrorData.ErrorCode, [
|
||||
Enums.Notification.AuthError, Enums.Notification.AccessError,
|
||||
Enums.Notification.ConnectionError, Enums.Notification.DomainNotAllowed, Enums.Notification.AccountNotAllowed,
|
||||
Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError
|
||||
]))
|
||||
{
|
||||
Globals.iAjaxErrorCount++;
|
||||
}
|
||||
|
||||
if (Enums.Notification.InvalidToken === oErrorData.ErrorCode)
|
||||
{
|
||||
Globals.iTokenErrorCount++;
|
||||
}
|
||||
|
||||
if (Consts.Values.TokenErrorLimit < Globals.iTokenErrorCount)
|
||||
{
|
||||
if (Globals.__APP__ && Globals.__APP__.loginAndLogoutReload)
|
||||
{
|
||||
Globals.__APP__.loginAndLogoutReload(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (oErrorData.ClearAuth || oErrorData.Logout || Consts.Values.AjaxErrorLimit < Globals.iAjaxErrorCount)
|
||||
{
|
||||
if (Globals.__APP__ && Globals.__APP__.clearClientSideToken)
|
||||
{
|
||||
Globals.__APP__.clearClientSideToken();
|
||||
}
|
||||
|
||||
if (Globals.__APP__ && !oErrorData.ClearAuth && Globals.__APP__.loginAndLogoutReload)
|
||||
{
|
||||
Globals.__APP__.loginAndLogoutReload(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (oH)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue