GUACAMOLE-742: Disable login form after credentials have been submitted.

This commit is contained in:
Michael Jumper
2019-04-27 16:56:11 -07:00
parent 59fdc80e9f
commit 583c82a45c
2 changed files with 32 additions and 5 deletions

View File

@@ -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,6 +151,9 @@ 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;
@@ -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) {

View File

@@ -23,13 +23,24 @@
<!-- Login fields -->
<div class="login-fields">
<guac-form namespace="'LOGIN'" content="remainingFields" model="enteredValues"></guac-form>
<guac-form
namespace="'LOGIN'"
content="remainingFields"
model="enteredValues"
disabled="submitted"></guac-form>
</div>
<!-- Submit button -->
<!-- Login/continue button -->
<div class="buttons">
<input type="submit" name="login" class="login" value="{{'LOGIN.ACTION_LOGIN' | translate}}"/>
<input type="submit" name="login" class="continue-login" value="{{'LOGIN.ACTION_CONTINUE' | translate}}"/>
<input type="submit" name="login" class="login"
ng-disabled="submitted"
value="{{'LOGIN.ACTION_LOGIN' | translate}}"/>
<input type="submit" name="login" class="continue-login"
ng-disabled="submitted"
value="{{'LOGIN.ACTION_CONTINUE' | translate}}"/>
</div>
</form>