KYLIN-1236 redirect to home page when input wrong url
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/bdcb29bf Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/bdcb29bf Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/bdcb29bf Branch: refs/heads/1.x-HBase1.1.3 Commit: bdcb29bf5c719ef1aa5dde071e8ccc824628a40c Parents: 623e70f Author: jian <jiazh...@apache.org> Authored: Wed Dec 16 01:07:39 2015 +0800 Committer: jian <jiazh...@apache.org> Committed: Wed Dec 16 01:08:24 2015 +0800 ---------------------------------------------------------------------- webapp/app/js/config.js | 2 +- webapp/app/js/listeners.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/bdcb29bf/webapp/app/js/config.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/config.js b/webapp/app/js/config.js index cf3ea6d..46fdecd 100644 --- a/webapp/app/js/config.js +++ b/webapp/app/js/config.js @@ -56,7 +56,7 @@ KylinApp.config(function ($routeProvider, $httpProvider, $locationProvider, $log // Loop over routes and add to router. angular.forEach(Config.routes, function (route) { - $routeProvider.when(route.url, route.params); + $routeProvider.when(route.url, route.params).otherwise({redirectTo:'/'}); }); // Set to use HTML5 mode, which removes the #! from modern browsers. http://git-wip-us.apache.org/repos/asf/kylin/blob/bdcb29bf/webapp/app/js/listeners.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/listeners.js b/webapp/app/js/listeners.js index 08a9bf9..2a01fff 100644 --- a/webapp/app/js/listeners.js +++ b/webapp/app/js/listeners.js @@ -27,6 +27,9 @@ KylinApp.run(function ($rootScope, $http, $location, UserService, Authentication $rootScope.$on("$routeChangeStart", function () { AuthenticationService.ping(function (data) { + if(!data.userDetails){ + $location.path(UserService.getHomePage()); + } UserService.setCurUser(data); });