You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by zh...@apache.org on 2015/12/15 18:01:05 UTC

kylin git commit: redirect to home page when input invalid url

Repository: kylin
Updated Branches:
  refs/heads/2.0-rc 681a21828 -> 996bbe221


redirect to home page when input invalid url


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/996bbe22
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/996bbe22
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/996bbe22

Branch: refs/heads/2.0-rc
Commit: 996bbe221ed2de8693ca62b559a6c2058e3e6c2f
Parents: 681a218
Author: jian <ji...@apache.org>
Authored: Wed Dec 16 01:00:43 2015 +0800
Committer: jian <ji...@apache.org>
Committed: Wed Dec 16 01:00:43 2015 +0800

----------------------------------------------------------------------
 webapp/app/js/config.js    | 2 +-
 webapp/app/js/listeners.js | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/996bbe22/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/996bbe22/webapp/app/js/listeners.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/listeners.js b/webapp/app/js/listeners.js
index 08a9bf9..7998481 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);
     });
 
@@ -39,7 +42,7 @@ KylinApp.run(function ($rootScope, $http, $location, UserService, Authentication
     }
   });
 
-  /**
+    /**
    * Holds all the requests which failed due to 401 response.
    */
   $rootScope.requests401 = [];