Skip to content

Commit

Permalink
AMBARI-25058 Ambari Admin doesn't redirect user to login page if auth…
Browse files Browse the repository at this point in the history
… session becomes invalidated. (ababiichuk)
  • Loading branch information
aBabiichuk committed Dec 20, 2018
1 parent c8e80ce commit 3fc52fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
21 changes: 7 additions & 14 deletions ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,14 @@ angular.module('ambariAdminConsole', [
}]);

$httpProvider.interceptors.push(['$rootScope', '$q', function (scope, $q) {
function success(response) {
return response;
}

function error(response) {
if (response.status == 403) {
window.location = Settings.siteRoot;
return;
return {
responseError: function (response) {
if (response.status === 403) {
window.location = Settings.siteRoot;
}
return $q.reject(response);
}
return $q.reject(response);
}

return function (promise) {
return promise.then(success, error);
}
};
}]);

$provide.factory('TimestampHttpInterceptor', [function($q) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,13 @@ angular.module('ambariAdminConsole')
var deferred = $q.defer();
var url = '/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/properties/user.inactivity.timeout.default';
$http.get(Settings.baseUrl + url)
.then(function(data) {
var properties = data.data.RootServiceComponents.properties;
var timeout = properties? properties['user.inactivity.timeout.default'] : 0;
deferred.resolve(timeout);
})
.catch(function(data) {
deferred.reject(data);
});
.then(function(data) {
var properties = data.data.RootServiceComponents.properties;
var timeout = properties ? properties['user.inactivity.timeout.default'] : 0;
deferred.resolve(timeout);
}, function (data) {
deferred.reject(data);
});

return deferred.promise;
},
Expand Down

0 comments on commit 3fc52fc

Please sign in to comment.