You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

navbar.controller.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * Created by robin on 11/1/15.
  3. */
  4. angular.module('luticate')
  5. .controller('NavBarController', ['$scope', 'luticateAuthCache', 'luticateAuthUsers', '$state',
  6. function($scope, luticateAuthCache, luticateAuthUsers, $state) {
  7. $scope.logout = function()
  8. {
  9. var promiseLogout = {
  10. id: "promiseLogout",
  11. loaderGroups: ["body"]
  12. };
  13. luticateAuthUsers.logout(promiseLogout).finally(function()
  14. {
  15. $state.go('login');
  16. });
  17. };
  18. $scope.isLogged = function()
  19. {
  20. var user = luticateAuthCache.getUser();
  21. return user != null && user.Id != 0;
  22. };
  23. $scope.getUsername = function()
  24. {
  25. var user = luticateAuthCache.getUser();
  26. if (user != null) {
  27. return user.Username;
  28. }
  29. return "";
  30. }
  31. }]);