mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-08 06:01:22 +00:00
GUAC-919: Rename LoginRESTService to TokenRESTService and provide logout semantics. Move Angular auth stuff to own module. Actually logout user.
This commit is contained in:
@@ -24,22 +24,14 @@ angular.module('login').controller('loginController', ['$scope', '$injector',
|
||||
function loginController($scope, $injector) {
|
||||
|
||||
// Get the dependencies commonJS style
|
||||
var authenticationService = $injector.get("authenticationService");
|
||||
var localStorageUtility = $injector.get("localStorageUtility");
|
||||
var $location = $injector.get("$location");
|
||||
var authenticationService = $injector.get("authenticationService");
|
||||
var $location = $injector.get("$location");
|
||||
|
||||
// Clear the auth token and userID to log out the user
|
||||
localStorageUtility.clear("authToken");
|
||||
localStorageUtility.clear("userID");
|
||||
|
||||
$scope.loginError = false;
|
||||
|
||||
$scope.login = function login() {
|
||||
authenticationService.login($scope.username, $scope.password)
|
||||
.success(function success(data, status, headers, config) {
|
||||
localStorageUtility.set('authToken', data.authToken);
|
||||
localStorageUtility.set('userID', data.userID);
|
||||
|
||||
// Set up the basic permissions for the user
|
||||
$scope.loadBasicPermissions();
|
||||
$location.path('/');
|
||||
@@ -47,4 +39,5 @@ angular.module('login').controller('loginController', ['$scope', '$injector',
|
||||
$scope.loginError = true;
|
||||
});
|
||||
};
|
||||
|
||||
}]);
|
||||
|
Reference in New Issue
Block a user