mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-742: Disable login form after credentials have been submitted.
This commit is contained in:
@@ -91,6 +91,16 @@ angular.module('login').directive('guacLogin', [function guacLogin() {
|
|||||||
*/
|
*/
|
||||||
$scope.remainingFields = [];
|
$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.
|
* Returns whether a previous login attempt is continuing.
|
||||||
*
|
*
|
||||||
@@ -141,8 +151,11 @@ angular.module('login').directive('guacLogin', [function guacLogin() {
|
|||||||
*/
|
*/
|
||||||
$scope.login = function login() {
|
$scope.login = function login() {
|
||||||
|
|
||||||
|
// Authentication is now in progress
|
||||||
|
$scope.submitted = true;
|
||||||
|
|
||||||
// Start with cleared status
|
// Start with cleared status
|
||||||
$scope.loginError = null;
|
$scope.loginError = null;
|
||||||
|
|
||||||
// Attempt login once existing session is destroyed
|
// Attempt login once existing session is destroyed
|
||||||
authenticationService.authenticate($scope.enteredValues)
|
authenticationService.authenticate($scope.enteredValues)
|
||||||
@@ -156,6 +169,9 @@ angular.module('login').directive('guacLogin', [function guacLogin() {
|
|||||||
// Reset upon failure
|
// Reset upon failure
|
||||||
['catch'](requestService.createErrorCallback(function loginFailed(error) {
|
['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
|
// Clear out passwords if the credentials were rejected for any reason
|
||||||
if (error.type !== Error.Type.INSUFFICIENT_CREDENTIALS) {
|
if (error.type !== Error.Type.INSUFFICIENT_CREDENTIALS) {
|
||||||
|
|
||||||
|
@@ -23,13 +23,24 @@
|
|||||||
|
|
||||||
<!-- Login fields -->
|
<!-- Login fields -->
|
||||||
<div class="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>
|
</div>
|
||||||
|
|
||||||
<!-- Submit button -->
|
<!-- Login/continue button -->
|
||||||
<div class="buttons">
|
<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>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
Reference in New Issue
Block a user