From f25e6cf1c291a3233ae5b5bdca080b06b3a26572 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 31 Jan 2019 15:52:32 -0500 Subject: [PATCH] (js) Improve CAS handling --- UI/WebServerResources/js/Common/Common.app.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/UI/WebServerResources/js/Common/Common.app.js b/UI/WebServerResources/js/Common/Common.app.js index 6b42481e0..208d0a7d0 100644 --- a/UI/WebServerResources/js/Common/Common.app.js +++ b/UI/WebServerResources/js/Common/Common.app.js @@ -313,22 +313,22 @@ deferred = $q.defer(); iframe = angular.element(''); iframe.on('load', function() { - if ($window.recovered) { + if (rejection.config.attempt) { // Already attempted once -- reload page angular.element($window).off('beforeunload'); $window.location.href = $window.ApplicationBaseURL; - deferred.resolve(); + deferred.reject(); } else { // Once the browser has followed the redirection, send the initial request $timeout(function() { var $http = $injector.get('$http'); - $http(rejection.config).then(function() { - $timeout(iframe.remove, 500); + rejection.config.attempt = 1; + $http(rejection.config).then(function(response) { + deferred.resolve(response); }); - $window.recovered = true; - deferred.reject(); // Will reload the page - }, 500); // Wait before replaying the request + $timeout(iframe.remove, 500); + }, 100); // Wait before replaying the request } }); document.body.appendChild(iframe[0]);