Browse Source

logout

develop
Robin Thoni 9 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
  */
3
  */
4
 
4
 
5
 angular.module('app')
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
                 $scope.toggleSideBar = function()
9
                 $scope.toggleSideBar = function()
10
                 {
10
                 {
18
                 $scope.isLogged = function () {
18
                 $scope.isLogged = function () {
19
                         return $scope.getCurrentUser() != null;
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
             <span><a ui-sref="signUp">Sign up</a></span> or
9
             <span><a ui-sref="signUp">Sign up</a></span> or
10
             <span><a ui-sref="login">Login</a></span>
10
             <span><a ui-sref="login">Login</a></span>
11
         </div>
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
     </div>
13
     </div>
14
 </md-toolbar>
14
 </md-toolbar>

Loading…
Cancel
Save