mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 21:51:23 +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}
|
* @returns {Promise}
|
||||||
* A promise which resolves successfully only after an attempt to
|
* 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) {
|
var updateCurrentToken = ['$injector', function updateCurrentToken($injector) {
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var $location = $injector.get('$location');
|
var $location = $injector.get('$location');
|
||||||
var $q = $injector.get('$q');
|
|
||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
|
|
||||||
// Promise for authentication attempt
|
|
||||||
var authAttempt = $q.defer();
|
|
||||||
|
|
||||||
// Re-authenticate including any parameters in URL
|
// Re-authenticate including any parameters in URL
|
||||||
authenticationService.updateCurrentToken($location.search())
|
return authenticationService.updateCurrentToken($location.search());
|
||||||
['finally'](function authenticationAttemptComplete() {
|
|
||||||
authAttempt.resolve();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Return promise that will resolve regardless of success/failure
|
|
||||||
return authAttempt.promise;
|
|
||||||
|
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user