From 695213dd31251192d1bfa855ed964af5174af56e Mon Sep 17 00:00:00 2001 From: Stan Silvert Date: Mon, 21 Nov 2016 11:44:58 -0500 Subject: [PATCH 1/2] KEYCLOAK-3948: Unexpected behavior when pressing Enter with some forms --- .../main/resources/theme/base/admin/resources/js/app.js | 6 ++++++ .../theme/base/admin/resources/js/controllers/users.js | 7 +++++++ .../base/admin/resources/partials/user-credentials.html | 6 +++--- .../admin/resources/templates/kc-component-config.html | 2 +- .../base/admin/resources/templates/kc-provider-config.html | 2 +- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/themes/src/main/resources/theme/base/admin/resources/js/app.js b/themes/src/main/resources/theme/base/admin/resources/js/app.js index e3b5cc5c06..c13c3ce5c2 100755 --- a/themes/src/main/resources/theme/base/admin/resources/js/app.js +++ b/themes/src/main/resources/theme/base/admin/resources/js/app.js @@ -2286,6 +2286,12 @@ module.directive('kcSave', function ($compile, Notifications) { elem.addClass("btn btn-primary"); elem.attr("type","submit"); elem.bind('click', function() { + console.info("***** clicked me ****"); + console.info("elem=" + elem); + console.info($scope.hasOwnProperty("changed")); + console.info("ctrl=" + ctrl); + if ($scope.hasOwnProperty("changed") && !$scope.changed) return; + $scope.$apply(function() { var form = elem.closest('form'); if (form && form.attr('name')) { diff --git a/themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js b/themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js index c3b7e1fb89..e13c66912b 100755 --- a/themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js +++ b/themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js @@ -526,6 +526,9 @@ module.controller('UserCredentialsCtrl', function($scope, realm, user, $route, R }); $scope.resetPassword = function() { + // hit enter without entering both fields - ignore + if (!$scope.passwordAndConfirmPasswordEntered()) return; + if ($scope.pwdChange) { if ($scope.password != $scope.confirmPassword) { Notifications.error("Password and confirmation does not match."); @@ -554,6 +557,10 @@ module.controller('UserCredentialsCtrl', function($scope, realm, user, $route, R }); }; + $scope.passwordAndConfirmPasswordEntered = function() { + return $scope.password && $scope.confirmPassword; + } + $scope.disableCredentialTypes = function() { Dialog.confirm('Disable credentials', 'Are you sure you want to disable these the users credentials?', function() { UserCredentials.disableCredentialTypes({ realm: realm.realm, userId: user.id }, $scope.disableableCredentialTypes, function() { diff --git a/themes/src/main/resources/theme/base/admin/resources/partials/user-credentials.html b/themes/src/main/resources/theme/base/admin/resources/partials/user-credentials.html index 1b545f74fa..d213fdd442 100755 --- a/themes/src/main/resources/theme/base/admin/resources/partials/user-credentials.html +++ b/themes/src/main/resources/theme/base/admin/resources/partials/user-credentials.html @@ -35,7 +35,7 @@
-
+
@@ -57,7 +57,7 @@
- +
{{:: 'credentials.disable.tooltip' | translate}}
@@ -79,7 +79,7 @@
- +
{{:: 'credentials.reset-actions-email.tooltip' | translate}} diff --git a/themes/src/main/resources/theme/base/admin/resources/templates/kc-component-config.html b/themes/src/main/resources/theme/base/admin/resources/templates/kc-component-config.html index 4062b1cc33..b3c84c6eee 100755 --- a/themes/src/main/resources/theme/base/admin/resources/templates/kc-component-config.html +++ b/themes/src/main/resources/theme/base/admin/resources/templates/kc-component-config.html @@ -27,7 +27,7 @@
- +
diff --git a/themes/src/main/resources/theme/base/admin/resources/templates/kc-provider-config.html b/themes/src/main/resources/theme/base/admin/resources/templates/kc-provider-config.html index 0309bb3227..131097bfd3 100755 --- a/themes/src/main/resources/theme/base/admin/resources/templates/kc-provider-config.html +++ b/themes/src/main/resources/theme/base/admin/resources/templates/kc-provider-config.html @@ -22,7 +22,7 @@
- +
From ee18d062ab37bde24ebba6697166b2e28dd59c50 Mon Sep 17 00:00:00 2001 From: Stan Silvert Date: Mon, 21 Nov 2016 11:48:07 -0500 Subject: [PATCH 2/2] KEYCLOAK-3948: Remove console.info() statements. --- .../src/main/resources/theme/base/admin/resources/js/app.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/themes/src/main/resources/theme/base/admin/resources/js/app.js b/themes/src/main/resources/theme/base/admin/resources/js/app.js index c13c3ce5c2..3b1172c95f 100755 --- a/themes/src/main/resources/theme/base/admin/resources/js/app.js +++ b/themes/src/main/resources/theme/base/admin/resources/js/app.js @@ -2286,10 +2286,6 @@ module.directive('kcSave', function ($compile, Notifications) { elem.addClass("btn btn-primary"); elem.attr("type","submit"); elem.bind('click', function() { - console.info("***** clicked me ****"); - console.info("elem=" + elem); - console.info($scope.hasOwnProperty("changed")); - console.info("ctrl=" + ctrl); if ($scope.hasOwnProperty("changed") && !$scope.changed) return; $scope.$apply(function() {