From 33ca0745585ae3fcd466631a069e244bea74be88 Mon Sep 17 00:00:00 2001 From: Serhii Tsymbaliuk Date: Wed, 13 May 2020 15:54:17 +0200 Subject: [PATCH] WebUI: Add confirmation dialog for changing default user/host group Changing default group on automember rules page is too easy. Add a confirmation dialog to avoid misclick in the case. Ticket: https://pagure.io/freeipa/issue/8322 Signed-off-by: Serhii Tsymbaliuk Reviewed-By: Florence Blanc-Renaud --- install/ui/src/freeipa/automember.js | 21 ++++++++++++++++----- ipaserver/plugins/internal.py | 3 +++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/install/ui/src/freeipa/automember.js b/install/ui/src/freeipa/automember.js index fd86b2ed2..38f754f8a 100644 --- a/install/ui/src/freeipa/automember.js +++ b/install/ui/src/freeipa/automember.js @@ -601,11 +601,22 @@ IPA.automember.default_group_widget = function(spec) { if (group === that.group) return; - if (group === '') { - that.remove_default_group(); - } else { - that.set_default_group(group); - } + var dialog = IPA.confirm_dialog({ + title: that.get_title(), + message: text.get('@i18n:objects.automember.default_group_confirm'), + on_ok: function() { + if (group === '') { + that.remove_default_group(); + } else { + that.set_default_group(group); + } + }, + on_cancel: function() { + that.group_select.update([that.group]); + } + }); + + dialog.open(); }; that.load = function(data) { diff --git a/ipaserver/plugins/internal.py b/ipaserver/plugins/internal.py index 6f01c473d..329fbd7b5 100644 --- a/ipaserver/plugins/internal.py +++ b/ipaserver/plugins/internal.py @@ -522,6 +522,9 @@ class i18n_messages(Command): "Add exclusive condition into '${primary_key}'" ), "attribute": _("Attribute"), + "default_group_confirm": _( + "Are you sure you want to change default group?" + ), "default_host_group": _("Default host group"), "default_user_group": _("Default user group"), "exclusive": _("Exclusive"),