mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-1126: Clear managed connections, if any, upon login. New sessions should start with a clean environment (fixes GUAC-1066).
This commit is contained in:
@@ -127,14 +127,22 @@ angular.module('client').factory('guacClientManager', ['$injector',
|
||||
|
||||
};
|
||||
|
||||
// Disconnect all clients when window is unloaded
|
||||
$window.addEventListener('unload', function disconnectAllClients() {
|
||||
/**
|
||||
* Disconnects and removes all currently-connected clients.
|
||||
*/
|
||||
service.clear = function clear() {
|
||||
|
||||
// Disconnect each managed client
|
||||
for (var id in service.managedClients)
|
||||
service.managedClients[id].client.disconnect();
|
||||
|
||||
});
|
||||
// Clear managed clients
|
||||
service.managedClients = {};
|
||||
|
||||
};
|
||||
|
||||
// Disconnect all clients when window is unloaded
|
||||
$window.addEventListener('unload', service.clear);
|
||||
|
||||
return service;
|
||||
|
||||
|
@@ -24,8 +24,9 @@ angular.module('login').controller('loginController', ['$scope', '$injector',
|
||||
function loginController($scope, $injector) {
|
||||
|
||||
// Required services
|
||||
var $location = $injector.get("$location");
|
||||
var authenticationService = $injector.get("authenticationService");
|
||||
var $location = $injector.get('$location');
|
||||
var authenticationService = $injector.get('authenticationService');
|
||||
var guacClientManager = $injector.get('guacClientManager');
|
||||
var userPageService = $injector.get('userPageService');
|
||||
|
||||
/**
|
||||
@@ -53,10 +54,16 @@ angular.module('login').controller('loginController', ['$scope', '$injector',
|
||||
|
||||
// Redirect to main view upon success
|
||||
.success(function success(data, status, headers, config) {
|
||||
|
||||
// Provide user with clean environment
|
||||
guacClientManager.clear();
|
||||
|
||||
// Redirect to main view
|
||||
userPageService.getHomePage()
|
||||
.then(function homePageRetrieved(homePage) {
|
||||
$location.url(homePage.url);
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
// Reset and focus password upon failure
|
||||
|
@@ -23,4 +23,4 @@
|
||||
/**
|
||||
* The module for the login functionality.
|
||||
*/
|
||||
angular.module('login', ['element', 'navigation']);
|
||||
angular.module('login', ['client', 'element', 'navigation']);
|
||||
|
Reference in New Issue
Block a user