You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/02/01 18:52:30 UTC

[31/71] [abbrv] brooklyn-ui git commit: Redirects web gui to root on logout to prevent login failure after logout

Redirects web gui to root on logout to prevent login failure after logout


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

Branch: refs/heads/0.7.0-incubating
Commit: f03c323f7c7124eef84578d0dd5a47cda239baf7
Parents: c7a0221
Author: Martin Harris <gi...@nakomis.com>
Authored: Thu Mar 5 13:05:00 2015 +0000
Committer: Martin Harris <gi...@nakomis.com>
Committed: Thu Mar 5 13:05:00 2015 +0000

----------------------------------------------------------------------
 .../webapp/assets/js/util/brooklyn-utils.js     | 20 ++++++++++++++++++++
 usage/jsgui/src/main/webapp/index.html          |  2 +-
 2 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/f03c323f/usage/jsgui/src/main/webapp/assets/js/util/brooklyn-utils.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/util/brooklyn-utils.js b/usage/jsgui/src/main/webapp/assets/js/util/brooklyn-utils.js
index 94a1299..318a734 100644
--- a/usage/jsgui/src/main/webapp/assets/js/util/brooklyn-utils.js
+++ b/usage/jsgui/src/main/webapp/assets/js/util/brooklyn-utils.js
@@ -174,6 +174,26 @@ define([
         return false; 
     };
 
+    Util.logout = function logout() {
+        $.ajax({
+            type: "POST",
+            dataType: "text",
+            url: "/logout",
+            success: function() {
+                window.location.replace("/");
+            },
+            failure: function() {
+                window.location.replace("/");
+            }
+        });
+    }
+
+    $("#logout-link").on("click", function (e) {
+        e.preventDefault();
+        Util.logout()
+        return false;
+    });
+
     return Util;
 
 });

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/f03c323f/usage/jsgui/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/index.html b/usage/jsgui/src/main/webapp/index.html
index 4458026..75733ab 100644
--- a/usage/jsgui/src/main/webapp/index.html
+++ b/usage/jsgui/src/main/webapp/index.html
@@ -44,7 +44,7 @@ under the License.
 
 <div class="navbar navbar-fixed-top">
     <div class="navbar-inner">
-        <div class="userName-top"><span id="user"></span> | <a href="/logout">Log out</a></div>
+        <div class="userName-top"><span id="user"></span> | <a href="/logout" id="logout-link">Log out</a></div>
         <div class="container">
             <a class="logo" href="#" title="Brooklyn, Version 0.7.0-SNAPSHOT"><!-- Logo added via CSS --></a> <!-- BROOKLYN_VERSION -->
             <div class="menubar-top">