Browse Source

logout

develop
Robin Thoni 8 years ago
parent
commit
926e4902e6
2 changed files with 10 additions and 3 deletions
  1. 9
    2
      public/app/controllers/toolbar.controller.js
  2. 1
    1
      public/app/views/toolbar.html

+ 9
- 2
public/app/controllers/toolbar.controller.js View File

@@ -3,8 +3,8 @@
3 3
  */
4 4
 
5 5
 angular.module('app')
6
-    .controller('ToolBarController', ['$scope', '$state', '$mdSidenav', 'luticateAuthCache',
7
-        function($scope, $state, $mdSidenav, luticateAuthCache) {
6
+    .controller('ToolBarController', ['$scope', '$state', '$mdSidenav', 'luticateAuthCache', 'luticateAuthUsers',
7
+        function($scope, $state, $mdSidenav, luticateAuthCache, luticateAuthUsers) {
8 8
 
9 9
                 $scope.toggleSideBar = function()
10 10
                 {
@@ -18,4 +18,11 @@ angular.module('app')
18 18
                 $scope.isLogged = function () {
19 19
                         return $scope.getCurrentUser() != null;
20 20
                 };
21
+
22
+                $scope.logout = function () {
23
+                        luticateAuthUsers.logout().then(function(data)
24
+                        {
25
+                                $state.go("home");
26
+                        });
27
+                }
21 28
         }]);

+ 1
- 1
public/app/views/toolbar.html View File

@@ -9,6 +9,6 @@
9 9
             <span><a ui-sref="signUp">Sign up</a></span> or
10 10
             <span><a ui-sref="login">Login</a></span>
11 11
         </div>
12
-        <span ng-show="isLogged()"><a ui-sref="login">{{ getCurrentUser().Firstname }} {{ getCurrentUser().Lastname }}</a></span>
12
+        <span ng-show="isLogged()"><a ng-click="logout()" href="">{{ getCurrentUser().Firstname }} {{ getCurrentUser().Lastname }}</a></span>
13 13
     </div>
14 14
 </md-toolbar>

Loading…
Cancel
Save