Logout button added 69/41769/7
authormichal.kovacik <mikovaci@cisco.com>
Wed, 13 Jul 2016 14:10:17 +0000 (16:10 +0200)
committerStanislav Jamrich <sjamrich@cisco.com>
Mon, 28 Nov 2016 12:14:18 +0000 (13:14 +0100)
- logout functionality enabled

Change-Id: I0dc1b67c86fbc105a527934f1855578d3408ba37
Signed-off-by: michal.kovacik <mikovaci@cisco.com>
modules/common-authentication-resources/src/main/resources/authentification/auth.services.js
modules/common-topbar-resources/src/main/resources/topbar/topbar.controller.js
modules/common-topbar-resources/src/main/resources/topbar/topbar.directives.js
modules/common-topbar-resources/src/main/resources/topbar/topbar.less
modules/common-topbar-resources/src/main/resources/topbar/topbar.tpl.html
modules/common-topbar-resources/src/main/resources/topbar/user_menu.tpl.html

index 4c81bbb547fbd70c4eb0e4ba235459ecbb23fb40..891e2b605f3e3235050c115e734342870133b11a 100644 (file)
@@ -23,6 +23,7 @@ define([], function () {
       }
       delete $window.sessionStorage.odlUser;
       delete $window.sessionStorage.odlPass;
+              document.cookie = 'JSESSIONID=; Path=/restconf; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
     };
 
     // Return the current user object
index 95ae0ee9cb9df864296fbe84e7d520f9dea21060..1b1aaf1140f804378810fc3de6ddaad60b967f87 100644 (file)
@@ -1,4 +1,4 @@
-define(['common/topbar/topbar.module'], function(topbar) {
+define(['common/topbar/topbar.module', 'common/topbar/topbar.directives', 'common/authentification/auth.services'], function(topbar) {
 
     topbar.controller('TopbarCtrl', function() {
         $('#toggleMenu').click(function(e) {
@@ -34,13 +34,17 @@ define(['common/topbar/topbar.module'], function(topbar) {
     });
 
     // the authorization module is not converted yet
-    topbar.controller('topBarUserMenuCtrl', function($scope, $cookieStore, /* Auth,*/ $window) {
-        $scope.logOut = function() {
-            /*Auth.logout(
-            function(res) {
-                $window.location.href = 'login.html';
-            });*/
+    topbar.controller('topBarUserMenuCtrl', function($scope, $cookieStore, Auth, $window) {
+        $scope.logOut = logout;
 
-        };
+        /**
+         * Provides logout from application and redirects to login page
+         * @return {[type]} [description]
+         */
+        function logout() {
+            Auth.logout(function() {
+                $window.location.href = 'index.html#/login';
+            });
+        }
     });
 });
index e32e2e71e93a8da67aec13085b04c82d11f85e46..f29e3c598d26414133de0c1fde20d467152c03d4 100644 (file)
@@ -34,7 +34,7 @@ define(['common/topbar/topbar.module'], function(topbar) {
         return {
             replace: true,
             controller: 'topBarUserMenuCtrl',
-            templateUrl: 'topbar/user_menu.tpl.html'
+            templateUrl: 'src/common/topbar/user_menu.tpl.html'
         };
     });
 });
index e85b446c3aefd089f0662b5cdf2dc30dce4046b5..dadf0a6ffb81b13d4380bd130043941f36645b2c 100644 (file)
@@ -25,4 +25,16 @@ div > nav.navbar {
   margin-bottom:0;
 }
 
+#logout-button {
+       color: #ffffff !important;
+       padding: 9px !important;
+       min-height: 0;
+}
+
+#logout-button:hover, #logout-button:active, #logout-button:focus {
+       background-color: inherit !important;
+}
 
+.navbar-top-links * {
+       vertical-align: middle;
+}
\ No newline at end of file
index 6f6915c1a308a424b65b5ef4ef9411fa8f314e8b..8fcb6efe7b4e5626ec96939b9797ade529ad1b75 100644 (file)
             <img src="assets/images/Info.png" class="right-topbar" border="0" alt="OpenDayLight" />
             <img src="assets/images/OSGI.png" class="right-topbar" border="0" alt="OpenDayLight" />-->
             <!-- for now no image since we dont use them.... -->
-            <!-- 
-            Don't need them for now...    
+            <!--
+            Don't need them for now...
             <div data-mc-top-bar-tasks></div>
             <div data-mc-top-bar-notifications></div>
             <div data-mc-top-bar-messages></div>
-
             -->
-            <!--<div data-mc-top-bar-user-menu></div>-->
+            <div data-mc-top-bar-user-menu></div>
       </ul><!-- /.ace-nav -->
 
 
index 7c506d7665fe778fce68ac78df593268be365168..29d369ea4292a0dd2272beec5eec7e3601327f9e 100644 (file)
@@ -1,19 +1 @@
-<li class="dropdown">
-    <a data-toggle="dropdown" href="" class="dropdown-toggle">
-        <img class="nav-user-photo" src="assets/images/user.jpg" alt="Jason's Photo">
-        <span class="user-info">
-            <small>Welcome,</small> Jason
-        </span>
-        <i class="icon-caret-down"></i>
-    </a>
-    <ul class="dropdown-menu dropdown-user">
-        <!-- only need logout for now...
-
-        <li><a href="#"><i class="icon-cog"></i> Settings</a></li>
-        <li><a href="#"><i class="icon-user"></i> Profile</a></li>
-        <li class="divider"></li>
-
-        -->
-        <li data-ng-click="logOut()"><a href="#"><i class="icon-off"></i> Logout</a></li>
-    </ul>
-</li>
\ No newline at end of file
+<li data-ng-click="logOut()"><a href="#" id="logout-button" class="btn"><i class="icon-off"></i> Logout</a></li>