GUAC-1161: Convert login page to directive which accepts a dynamic form. Display login directive when credentials are needed.

This commit is contained in:
Michael Jumper
2015-04-21 12:02:01 -07:00
parent 872aa38498
commit f29a24ad68
12 changed files with 214 additions and 221 deletions

View File

@@ -48,6 +48,7 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
// Get required services
var $document = $injector.get('$document');
var $location = $injector.get('$location');
var $route = $injector.get('$route');
var authenticationService = $injector.get('authenticationService');
var userPageService = $injector.get('userPageService');
@@ -100,12 +101,15 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
};
/**
* Logs out the current user, redirecting them to back to the login
* screen after logout completes.
* Logs out the current user, redirecting them to back to the root
* after logout completes.
*/
$scope.logout = function logout() {
authenticationService.logout()['finally'](function logoutComplete() {
$location.path('/login/');
if ($location.path() !== '/')
$location.url('/');
else
$route.reload();
});
};