Repository: ambari Updated Branches: refs/heads/trunk 0715d9bf3 -> dceec5cc6
AMBARI-6831. Admin View: if the session is invalidated, redirect the user to the login page. (yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/dceec5cc Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/dceec5cc Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/dceec5cc Branch: refs/heads/trunk Commit: dceec5cc67a2740a3af333ebae10cfb0e306c2c6 Parents: 0715d9b Author: Yusaku Sako <[email protected]> Authored: Tue Aug 12 11:14:46 2014 -0700 Committer: Yusaku Sako <[email protected]> Committed: Tue Aug 12 11:17:46 2014 -0700 ---------------------------------------------------------------------- .../resources/ui/admin-web/app/scripts/app.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/dceec5cc/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js ---------------------------------------------------------------------- diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js index 7ddeb44..b9fcce2 100644 --- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js +++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js @@ -39,6 +39,24 @@ angular.module('ambariAdminConsole', [ $httpProvider.defaults.headers.put['X-Requested-By'] = 'ambari'; $httpProvider.defaults.headers.common['X-Requested-By'] = 'ambari'; + $httpProvider.responseInterceptors.push(['$rootScope', '$q', function (scope, $q) { + function success(response) { + return response; + } + + function error(response) { + if (response.status == 403) { + window.location = "/"; + return; + } + return $q.reject(response); + } + + return function (promise) { + return promise.then(success, error); + } + }]); + $provide.decorator('ngFormDirective', ['$delegate', function($delegate) { var ngForm = $delegate[0], controller = ngForm.controller; ngForm.controller = ['$scope', '$element', '$attrs', '$injector', function(scope, element, attrs, $injector) {
