From 5d3364a543a65eaa6ed94005cdab6dd1d3745c49 Mon Sep 17 00:00:00 2001 From: Serhii Tsymbaliuk Date: May 18 2020 07:05:02 +0000 Subject: 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 --- diff --git a/install/ui/src/freeipa/automember.js b/install/ui/src/freeipa/automember.js index fd86b2e..38f754f 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 6f01c47..329fbd7 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"),