Skip to content

Commit

Permalink
Prevent double-submit of the form that could lead to a failing reques…
Browse files Browse the repository at this point in the history
…t in the backend.

As this element is wrapped inside a form, the click would otherwise also submit the form.

Closes keycloak#11819
  • Loading branch information
ahus1 authored and hmlnarik committed May 10, 2022
1 parent 5d87cdf commit ca2c605
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2226,8 +2226,11 @@ module.controller('ClientScopeMappingCtrl', function($scope, $http, realm, $rout
return $scope.client.fullScopeAllowed;
}

$scope.changeFlag = function() {
$scope.changeFlag = function(event) {
console.log('changeFlag');
event.stopPropagation();
event.preventDefault();
$scope.client.fullScopeAllowed = !$scope.client.fullScopeAllowed
Client.update({
realm : realm.realm,
client : client.id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h2><span>{{client.clientId}}</span> {{:: 'scope-mappings' | translate}} </h2>
<label class="col-md-2 control-label" for="fullScopeAllowed">{{:: 'full-scope-allowed' | translate}}</label>
<kc-tooltip>{{:: 'full-scope-allowed.tooltip' | translate}}</kc-tooltip>
<div class="col-md-6">
<input kc-read-only="!client.access.manage" ng-model="client.fullScopeAllowed" ng-click="changeFlag()" name="fullScopeAllowed" id="fullScopeAllowed" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}" />
<input kc-read-only="!client.access.manage" ng-model="client.fullScopeAllowed" ng-click="changeFlag($event)" name="fullScopeAllowed" id="fullScopeAllowed" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}" />
</div>
</div>
</fieldset>
Expand Down

0 comments on commit ca2c605

Please sign in to comment.