Merge pull request #3532 from ssilvert/enter-key
KEYCLOAK-3948: Unexpected behavior when pressing Enter with some forms
This commit is contained in:
commit
33cd261d83
5 changed files with 14 additions and 5 deletions
|
@ -2286,6 +2286,8 @@ module.directive('kcSave', function ($compile, Notifications) {
|
|||
elem.addClass("btn btn-primary");
|
||||
elem.attr("type","submit");
|
||||
elem.bind('click', function() {
|
||||
if ($scope.hasOwnProperty("changed") && !$scope.changed) return;
|
||||
|
||||
$scope.$apply(function() {
|
||||
var form = elem.closest('form');
|
||||
if (form && form.attr('name')) {
|
||||
|
|
|
@ -535,6 +535,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.");
|
||||
|
@ -563,6 +566,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() {
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-10 col-md-offset-2" data-ng-show="password && confirmPassword">
|
||||
<div class="col-md-10 col-md-offset-2" data-ng-show="passwordAndConfirmPasswordEntered()">
|
||||
<button class="btn btn-danger" type="submit" data-ng-click="resetPassword(true)">{{:: 'reset-password' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -57,7 +57,7 @@
|
|||
<label class="col-md-2 control-label" for="disableCredentialTypes">{{:: 'disable-credential-types' | translate}}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<button id="disableCredentialTypes" class="btn btn-default" data-ng-click="disableCredentialTypes()">{{:: 'disable' | translate}}</button>
|
||||
<button type="button" id="disableCredentialTypes" class="btn btn-default" data-ng-click="disableCredentialTypes()">{{:: 'disable' | translate}}</button>
|
||||
</div>
|
||||
<kc-tooltip>{{:: 'credentials.disable.tooltip' | translate}}</kc-tooltip>
|
||||
</div>
|
||||
|
@ -79,7 +79,7 @@
|
|||
<label class="col-md-2 control-label" for="reqActionsEmail">{{:: 'reset-actions-email' | translate}}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<button id="reqActionsEmail" class="btn btn-default" data-ng-click="sendExecuteActionsEmail()">{{:: 'send-email' | translate}}</button>
|
||||
<button type="button" id="reqActionsEmail" class="btn btn-default" data-ng-click="sendExecuteActionsEmail()">{{:: 'send-email' | translate}}</button>
|
||||
</div>
|
||||
<kc-tooltip>{{:: 'credentials.reset-actions-email.tooltip' | translate}}</kc-tooltip>
|
||||
</div>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<input class="form-control" type="text" data-ng-model="config[ option.name ][0]" >
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button type="submit" data-ng-click="openRoleSelector(option.name, config)" class="btn btn-default" tooltip-placement="top" tooltip-trigger="mouseover mouseout" tooltip="{{:: 'selectRole.tooltip' | translate}}">{{:: 'selectRole.label' | translate}}</button>
|
||||
<button type="button" data-ng-click="openRoleSelector(option.name, config)" class="btn btn-default" tooltip-placement="top" tooltip-trigger="mouseover mouseout" tooltip="{{:: 'selectRole.tooltip' | translate}}">{{:: 'selectRole.label' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<input class="form-control" type="text" data-ng-model="config[ option.name ]" >
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button type="submit" data-ng-click="openRoleSelector(option.name, config)" class="btn btn-default" tooltip-placement="top" tooltip-trigger="mouseover mouseout" tooltip="{{:: 'selectRole.tooltip' | translate}}">{{:: 'selectRole.label' | translate}}</button>
|
||||
<button type="button" data-ng-click="openRoleSelector(option.name, config)" class="btn btn-default" tooltip-placement="top" tooltip-trigger="mouseover mouseout" tooltip="{{:: 'selectRole.tooltip' | translate}}">{{:: 'selectRole.label' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue