GUACAMOLE-526: Merge invoke logout() before storing new token.

This commit is contained in:
Nick Couchman
2018-04-30 07:59:37 -04:00

View File

@@ -168,7 +168,6 @@ angular.module('auth').factory('authenticationService', ['$injector',
.then(function authenticationSuccessful(data) { .then(function authenticationSuccessful(data) {
var currentToken = service.getCurrentToken(); var currentToken = service.getCurrentToken();
setAuthenticationResult(new AuthenticationResult(data));
// If a new token was received, ensure the old token is invalidated, // If a new token was received, ensure the old token is invalidated,
// if any, and notify listeners of the new token // if any, and notify listeners of the new token
@@ -180,10 +179,16 @@ angular.module('auth').factory('authenticationService', ['$injector',
} }
// Notify of login and new token // Notify of login and new token
setAuthenticationResult(new AuthenticationResult(data));
$rootScope.$broadcast('guacLogin', data.authToken); $rootScope.$broadcast('guacLogin', data.authToken);
} }
// Update cached authentication result, even if the token remains
// the same
else
setAuthenticationResult(new AuthenticationResult(data));
// Authentication was successful // Authentication was successful
return data; return data;