From 583c82a45c7c970336578ea5fd792843b3737b90 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 27 Apr 2019 16:56:11 -0700 Subject: [PATCH] GUACAMOLE-742: Disable login form after credentials have been submitted. --- .../main/webapp/app/login/directives/login.js | 18 +++++++++++++++++- .../webapp/app/login/templates/login.html | 19 +++++++++++++++---- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/guacamole/src/main/webapp/app/login/directives/login.js b/guacamole/src/main/webapp/app/login/directives/login.js index 562e3972e..e3a553c61 100644 --- a/guacamole/src/main/webapp/app/login/directives/login.js +++ b/guacamole/src/main/webapp/app/login/directives/login.js @@ -91,6 +91,16 @@ angular.module('login').directive('guacLogin', [function guacLogin() { */ $scope.remainingFields = []; + /** + * Whether an authentication attempt has been submitted. This will be + * set to true once credentials have been submitted and will only be + * reset to false once the attempt has been fully processed, including + * rerouting the user to the requested page if the attempt succeeded. + * + * @type Boolean + */ + $scope.submitted = false; + /** * Returns whether a previous login attempt is continuing. * @@ -141,8 +151,11 @@ angular.module('login').directive('guacLogin', [function guacLogin() { */ $scope.login = function login() { + // Authentication is now in progress + $scope.submitted = true; + // Start with cleared status - $scope.loginError = null; + $scope.loginError = null; // Attempt login once existing session is destroyed authenticationService.authenticate($scope.enteredValues) @@ -156,6 +169,9 @@ angular.module('login').directive('guacLogin', [function guacLogin() { // Reset upon failure ['catch'](requestService.createErrorCallback(function loginFailed(error) { + // Initial submission is complete and has failed + $scope.submitted = false; + // Clear out passwords if the credentials were rejected for any reason if (error.type !== Error.Type.INSUFFICIENT_CREDENTIALS) { diff --git a/guacamole/src/main/webapp/app/login/templates/login.html b/guacamole/src/main/webapp/app/login/templates/login.html index 26a3f1889..833fef61b 100644 --- a/guacamole/src/main/webapp/app/login/templates/login.html +++ b/guacamole/src/main/webapp/app/login/templates/login.html @@ -23,13 +23,24 @@
- +
- +
- - + + + + +