(js) Improve CAS handling

This commit is contained in:
Francis Lachapelle 2017-05-08 15:43:10 -04:00
parent ba583f41b1
commit 836700fb7e

View file

@ -255,14 +255,14 @@
/** /**
* @ngInject * @ngInject
*/ */
ErrorInterceptor.$inject = ['$rootScope', '$q', '$injector']; ErrorInterceptor.$inject = ['$rootScope', '$window', '$q', '$injector'];
function ErrorInterceptor($rootScope, $q, $injector) { function ErrorInterceptor($rootScope, $window, $q, $injector) {
return { return {
responseError: function(rejection) { responseError: function(rejection) {
var deferred, iframe; var deferred, iframe;
if (/^application\/json/.test(rejection.config.headers.Accept)) { if (/^application\/json/.test(rejection.config.headers.Accept)) {
// Handle CAS ticket renewal (TODO: add check on usesCASAuthentication) // Handle CAS ticket renewal
if (rejection.status == -1) { if ($window.usesCASAuthentication && rejection.status == -1) {
deferred = $q.defer(); deferred = $q.defer();
iframe = angular.element('<iframe class="ng-hide" src="' + UserFolderURL + 'recover"></iframe>'); iframe = angular.element('<iframe class="ng-hide" src="' + UserFolderURL + 'recover"></iframe>');
iframe.on('load', function() { iframe.on('load', function() {