From 59fdc80e9f45ac2fc2fcb884ff4900faeb5fabb8 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 27 Apr 2019 16:52:37 -0700 Subject: [PATCH 1/5] GUACAMOLE-742: Provide "disabled" attribute for forms and fields. --- guacamole/src/main/webapp/app/form/directives/form.js | 10 +++++++++- .../src/main/webapp/app/form/directives/formField.js | 10 +++++++++- .../src/main/webapp/app/form/services/formService.js | 4 ++++ .../main/webapp/app/form/templates/checkboxField.html | 2 +- .../src/main/webapp/app/form/templates/dateField.html | 1 + .../src/main/webapp/app/form/templates/emailField.html | 1 + guacamole/src/main/webapp/app/form/templates/form.html | 1 + .../main/webapp/app/form/templates/numberField.html | 2 +- .../main/webapp/app/form/templates/passwordField.html | 2 +- .../main/webapp/app/form/templates/selectField.html | 3 ++- .../main/webapp/app/form/templates/textAreaField.html | 2 +- .../src/main/webapp/app/form/templates/textField.html | 3 ++- .../src/main/webapp/app/form/templates/timeField.html | 1 + .../main/webapp/app/form/templates/timeZoneField.html | 3 ++- 14 files changed, 36 insertions(+), 9 deletions(-) diff --git a/guacamole/src/main/webapp/app/form/directives/form.js b/guacamole/src/main/webapp/app/form/directives/form.js index 518db7dba..be2f3b176 100644 --- a/guacamole/src/main/webapp/app/form/directives/form.js +++ b/guacamole/src/main/webapp/app/form/directives/form.js @@ -64,7 +64,15 @@ angular.module('form').directive('guacForm', [function form() { * * @type Boolean */ - modelOnly : '=' + modelOnly : '=', + + /** + * Whether the contents of the form should be rendered as disabled. + * By default, form fields are enabled. + * + * @type Boolean + */ + disabled : '=' }, templateUrl: 'app/form/templates/form.html', diff --git a/guacamole/src/main/webapp/app/form/directives/formField.js b/guacamole/src/main/webapp/app/form/directives/formField.js index ea0f35fd7..15adc29e4 100644 --- a/guacamole/src/main/webapp/app/form/directives/formField.js +++ b/guacamole/src/main/webapp/app/form/directives/formField.js @@ -53,7 +53,15 @@ angular.module('form').directive('guacFormField', [function formField() { * * @type String */ - model : '=' + model : '=', + + /** + * Whether this field should be rendered as disabled. By default, + * form fields are enabled. + * + * @type Boolean + */ + disabled : '=' }, templateUrl: 'app/form/templates/formField.html', diff --git a/guacamole/src/main/webapp/app/form/services/formService.js b/guacamole/src/main/webapp/app/form/services/formService.js index 168a1efa7..21bfb4742 100644 --- a/guacamole/src/main/webapp/app/form/services/formService.js +++ b/guacamole/src/main/webapp/app/form/services/formService.js @@ -213,6 +213,10 @@ angular.module('form').provider('formService', function formServiceProvider() { * model: * The current String value of the field, if any. * + * disabled: + * A boolean value which is true if the field should be disabled. + * If false or undefined, the field should be enabled. + * * @param {Element} fieldContainer * The DOM Element whose contents should be replaced with the * compiled field template. diff --git a/guacamole/src/main/webapp/app/form/templates/checkboxField.html b/guacamole/src/main/webapp/app/form/templates/checkboxField.html index ad9d8e006..b76368afe 100644 --- a/guacamole/src/main/webapp/app/form/templates/checkboxField.html +++ b/guacamole/src/main/webapp/app/form/templates/checkboxField.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/guacamole/src/main/webapp/app/form/templates/dateField.html b/guacamole/src/main/webapp/app/form/templates/dateField.html index a186e19a5..b6af5463c 100644 --- a/guacamole/src/main/webapp/app/form/templates/dateField.html +++ b/guacamole/src/main/webapp/app/form/templates/dateField.html @@ -1,5 +1,6 @@
diff --git a/guacamole/src/main/webapp/app/form/templates/numberField.html b/guacamole/src/main/webapp/app/form/templates/numberField.html index 3d6312e20..007297365 100644 --- a/guacamole/src/main/webapp/app/form/templates/numberField.html +++ b/guacamole/src/main/webapp/app/form/templates/numberField.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/guacamole/src/main/webapp/app/form/templates/passwordField.html b/guacamole/src/main/webapp/app/form/templates/passwordField.html index 506d8b6b2..56472ef4e 100644 --- a/guacamole/src/main/webapp/app/form/templates/passwordField.html +++ b/guacamole/src/main/webapp/app/form/templates/passwordField.html @@ -1,4 +1,4 @@
- +
\ No newline at end of file diff --git a/guacamole/src/main/webapp/app/form/templates/selectField.html b/guacamole/src/main/webapp/app/form/templates/selectField.html index 3bd2bb876..2f2b9d5ee 100644 --- a/guacamole/src/main/webapp/app/form/templates/selectField.html +++ b/guacamole/src/main/webapp/app/form/templates/selectField.html @@ -1 +1,2 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/guacamole/src/main/webapp/app/form/templates/textAreaField.html b/guacamole/src/main/webapp/app/form/templates/textAreaField.html index 082476f14..e049df60d 100644 --- a/guacamole/src/main/webapp/app/form/templates/textAreaField.html +++ b/guacamole/src/main/webapp/app/form/templates/textAreaField.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/guacamole/src/main/webapp/app/form/templates/textField.html b/guacamole/src/main/webapp/app/form/templates/textField.html index a338db4cd..819ae038a 100644 --- a/guacamole/src/main/webapp/app/form/templates/textField.html +++ b/guacamole/src/main/webapp/app/form/templates/textField.html @@ -1,5 +1,6 @@
- + diff --git a/guacamole/src/main/webapp/app/form/templates/timeField.html b/guacamole/src/main/webapp/app/form/templates/timeField.html index 24ae968b0..d45f54c91 100644 --- a/guacamole/src/main/webapp/app/form/templates/timeField.html +++ b/guacamole/src/main/webapp/app/form/templates/timeField.html @@ -1,5 +1,6 @@
From 583c82a45c7c970336578ea5fd792843b3737b90 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 27 Apr 2019 16:56:11 -0700 Subject: [PATCH 2/5] 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 @@ - +
- - + + + + +
From 81872f571824a7420b2278982f3eff600ad6a730 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 27 Apr 2019 16:56:47 -0700 Subject: [PATCH 3/5] GUACAMOLE-742: Fade in overall login UI, not just login dialog. Placing the fade animation on the login dialog (which also handles the error shake-head animation) results in the dialog fading in each time the login process changes state. It really should only fade when the overall login interface initially appears. --- .../src/main/webapp/app/login/directives/login.js | 11 +++++++++-- guacamole/src/main/webapp/app/login/styles/dialog.css | 10 ++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/guacamole/src/main/webapp/app/login/directives/login.js b/guacamole/src/main/webapp/app/login/directives/login.js index e3a553c61..aad7020b9 100644 --- a/guacamole/src/main/webapp/app/login/directives/login.js +++ b/guacamole/src/main/webapp/app/login/directives/login.js @@ -66,6 +66,7 @@ angular.module('login').directive('guacLogin', [function guacLogin() { var Field = $injector.get('Field'); // Required services + var $rootScope = $injector.get('$rootScope'); var $route = $injector.get('$route'); var authenticationService = $injector.get('authenticationService'); var requestService = $injector.get('requestService'); @@ -160,9 +161,9 @@ angular.module('login').directive('guacLogin', [function guacLogin() { // Attempt login once existing session is destroyed authenticationService.authenticate($scope.enteredValues) - // Clear and reload upon success + // Retry route upon success (entered values will be cleared only + // after route change has succeeded as this can take time) .then(function loginSuccessful() { - $scope.enteredValues = {}; $route.reload(); }) @@ -199,6 +200,12 @@ angular.module('login').directive('guacLogin', [function guacLogin() { }; + // Reset state after authentication and routing have succeeded + $rootScope.$on('$routeChangeSuccess', function routeChanged() { + $scope.enteredValues = {}; + $scope.submitted = false; + }); + }]; return directive; diff --git a/guacamole/src/main/webapp/app/login/styles/dialog.css b/guacamole/src/main/webapp/app/login/styles/dialog.css index c9c6a4af6..998ce133f 100644 --- a/guacamole/src/main/webapp/app/login/styles/dialog.css +++ b/guacamole/src/main/webapp/app/login/styles/dialog.css @@ -26,6 +26,12 @@ -webkit-animation-timing-function: linear; } +.login-ui { + animation: fadein 0.125s linear; + -moz-animation: fadein 0.125s linear; + -webkit-animation: fadein 0.125s linear; +} + .login-ui div.login-dialog-middle { width: 100%; display: table-cell; @@ -35,10 +41,6 @@ .login-ui div.login-dialog { - animation: fadein 0.125s linear; - -moz-animation: fadein 0.125s linear; - -webkit-animation: fadein 0.125s linear; - width: 100%; max-width: 3in; text-align: left; From 6a9981c1602191b66c6a5ffc64c383508a99b5fd Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 27 Apr 2019 17:41:42 -0700 Subject: [PATCH 4/5] GUACAMOLE-742: Remove unnecessary element specificity of login CSS selectors. --- guacamole/src/main/webapp/app/login/styles/dialog.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guacamole/src/main/webapp/app/login/styles/dialog.css b/guacamole/src/main/webapp/app/login/styles/dialog.css index 998ce133f..fb4fcecc9 100644 --- a/guacamole/src/main/webapp/app/login/styles/dialog.css +++ b/guacamole/src/main/webapp/app/login/styles/dialog.css @@ -32,14 +32,14 @@ -webkit-animation: fadein 0.125s linear; } -.login-ui div.login-dialog-middle { +.login-ui .login-dialog-middle { width: 100%; display: table-cell; vertical-align: middle; text-align: center; } -.login-ui div.login-dialog { +.login-ui .login-dialog { width: 100%; max-width: 3in; @@ -117,7 +117,7 @@ background-image: url("images/guac-tricolor.png"); } -.login-ui.continuation div.login-dialog { +.login-ui.continuation .login-dialog { border-right: none; border-left: none; box-shadow: none; From 91f6bf23c504f19bd748b1baab7d70c7b9064cef Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 27 Apr 2019 17:43:07 -0700 Subject: [PATCH 5/5] GUACAMOLE-742: Reorganize login dialog CSS hierarchically. --- .../main/webapp/app/login/styles/dialog.css | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/guacamole/src/main/webapp/app/login/styles/dialog.css b/guacamole/src/main/webapp/app/login/styles/dialog.css index fb4fcecc9..e83353331 100644 --- a/guacamole/src/main/webapp/app/login/styles/dialog.css +++ b/guacamole/src/main/webapp/app/login/styles/dialog.css @@ -17,15 +17,6 @@ * under the License. */ -.login-ui.error .login-dialog { - animation-name: shake-head; - animation-duration: 0.25s; - animation-timing-function: linear; - -webkit-animation-name: shake-head; - -webkit-animation-duration: 0.25s; - -webkit-animation-timing-function: linear; -} - .login-ui { animation: fadein 0.125s linear; -moz-animation: fadein 0.125s linear; @@ -128,3 +119,12 @@ .login-ui.continuation .login-dialog .version { display: none; } + +.login-ui.error .login-dialog { + animation-name: shake-head; + animation-duration: 0.25s; + animation-timing-function: linear; + -webkit-animation-name: shake-head; + -webkit-animation-duration: 0.25s; + -webkit-animation-timing-function: linear; +}