Skip to content

Commit

Permalink
(js) Improve CAS handling
Browse files Browse the repository at this point in the history
  • Loading branch information
cgx committed Sep 30, 2019
1 parent 5b818e8 commit bd9dfe6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions UI/WebServerResources/js/Common/Common.app.js
Expand Up @@ -296,15 +296,15 @@
/**
* @ngInject
*/
AuthInterceptor.$inject = ['$window', '$q'];
function AuthInterceptor($window, $q) {
AuthInterceptor.$inject = ['$window', '$q', '$state'];
function AuthInterceptor($window, $q, $state) {
return {
response: function(response) {
// When expecting JSON but receiving HTML, assume session has expired and reload page
if (response && /^application\/json/.test(response.config.headers.Accept) &&
/^[\n\r ]*<!DOCTYPE html/.test(response.data)) {
angular.element($window).off('beforeunload');
$window.location.href = $window.ApplicationBaseURL;
$window.location.href = $window.ApplicationBaseURL + $state.href($state.current);
return $q.reject();
}
return response;
Expand All @@ -315,8 +315,8 @@
/**
* @ngInject
*/
ErrorInterceptor.$inject = ['$rootScope', '$window', '$q', '$timeout', '$injector'];
function ErrorInterceptor($rootScope, $window, $q, $timeout, $injector) {
ErrorInterceptor.$inject = ['$rootScope', '$window', '$q', '$timeout', '$injector', '$state'];
function ErrorInterceptor($rootScope, $window, $q, $timeout, $injector, $state) {
return {
responseError: function(rejection) {
var deferred, iframe;
Expand Down Expand Up @@ -350,7 +350,7 @@
else if ($window.usesSAML2Authentication && rejection.status == 401 && !$window.recovered) {
angular.element($window).off('beforeunload');
$window.recovered = true;
$window.location.href = $window.ApplicationBaseURL;
$window.location.href = $window.ApplicationBaseURL + $state.href($state.current);
}
else {
// Broadcast the response error
Expand Down

0 comments on commit bd9dfe6

Please sign in to comment.