mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-1161: Do not continue routing if authentication fails.
This commit is contained in:
@@ -39,26 +39,17 @@ angular.module('index').config(['$routeProvider', '$locationProvider',
|
||||
*
|
||||
* @returns {Promise}
|
||||
* A promise which resolves successfully only after an attempt to
|
||||
* re-authenticate has been made.
|
||||
* re-authenticate has been made. If the authentication attempt fails,
|
||||
* the promise will be rejected.
|
||||
*/
|
||||
var updateCurrentToken = ['$injector', function updateCurrentToken($injector) {
|
||||
|
||||
// Required services
|
||||
var $location = $injector.get('$location');
|
||||
var $q = $injector.get('$q');
|
||||
var authenticationService = $injector.get('authenticationService');
|
||||
|
||||
// Promise for authentication attempt
|
||||
var authAttempt = $q.defer();
|
||||
|
||||
// Re-authenticate including any parameters in URL
|
||||
authenticationService.updateCurrentToken($location.search())
|
||||
['finally'](function authenticationAttemptComplete() {
|
||||
authAttempt.resolve();
|
||||
});
|
||||
|
||||
// Return promise that will resolve regardless of success/failure
|
||||
return authAttempt.promise;
|
||||
return authenticationService.updateCurrentToken($location.search());
|
||||
|
||||
}];
|
||||
|
||||
|
Reference in New Issue
Block a user