N°2822 - Fix timeout message through AJAX calls in the Portal

This commit is contained in:
Molkobain
2020-02-28 16:52:09 +01:00
parent ffa43160bf
commit 39d3e00ba1
2 changed files with 8 additions and 0 deletions

View File

@@ -65,6 +65,10 @@ class UserProvider implements ContainerAwareInterface
public function onKernelRequest(GetResponseEvent $oGetResponseEvent)
{
// User pre-checks
// Note: The following note and handling of the $iExitMethod were for the old login mechanism
// and hasn't been reworked after the introduction of the new one as we saw it too late.
// $iExitMethod and $iLogonRes may be useless now as the DoLoginEx method exits directly sometimes.
//
// Note: At this point the Exception handler is not registered, so we can't use $oApp::abort() method, hence the die().
// - Checking user rights and prompt if needed (401 HTTP code returned if XHR request)
$iExitMethod = ($oGetResponseEvent->getRequest()->isXmlHttpRequest()) ? LoginWebPage::EXIT_RETURN : LoginWebPage::EXIT_PROMPT;

View File

@@ -466,6 +466,10 @@
$(document).ready(function(){
{% block pPageReadyScripts %}
// Add proprietary header to identify our XHR calls
$(document).ajaxSend(function(oEvent, oXHR, oOptions) {
oXHR.setRequestHeader('X-Combodo-Ajax', 'true');
});
// Handle AJAX errors (exceptions (500), logout (401), ...)
$(document).ajaxError(function(oEvent, oXHR, oSettings, sError){
if(oXHR.status === 401)