ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject ambari git commit: AMBARI-9720 Handle login redirection in case the user hits a view URL and not authenticated. (atkach)
Date Fri, 20 Feb 2015 13:28:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 0774c1508 -> afc6a9dc1


AMBARI-9720 Handle login redirection in case the user hits a view URL and not authenticated.
(atkach)


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

Branch: refs/heads/trunk
Commit: afc6a9dc1426a015da7bf8bfc4a2d09bae8eb337
Parents: 0774c15
Author: Andrii Tkach <atkach@hortonworks.com>
Authored: Fri Feb 20 13:07:04 2015 +0200
Committer: Andrii Tkach <atkach@hortonworks.com>
Committed: Fri Feb 20 13:07:04 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/router.js | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/afc6a9dc/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index e738c10..fe37e0e 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -457,6 +457,10 @@ App.Router = Em.Router.extend({
        */
       enter: function (router, context) {
         router.getAuthenticated().done(function (loggedIn) {
+          var location = router.location.location.hash;
+          //key to parse URI for prefered path to route
+          var key = '?targetURI=';
+
           if (loggedIn) {
             Ember.run.next(function () {
               console.log(router.getLoginName() + ' already authenticated.  Redirecting...');
@@ -464,6 +468,10 @@ App.Router = Em.Router.extend({
                 router.transitionTo(route, context);
               });
             });
+          } else {
+            if (location.contains(key)) {
+              router.set('preferedPath', location.slice(location.indexOf(key) + key.length));
+            }
           }
         });
       },


Mime
View raw message