From e5fe9d5c29a2e92d4d5bcedea6f3f5325e93befe Mon Sep 17 00:00:00 2001 From: marcos Date: Mon, 5 Oct 2020 12:29:51 +0200 Subject: [PATCH] feature 2FA_all_users --- pandora_console/godmode/setup/setup_auth.php | 7 +----- pandora_console/operation/users/user_edit.php | 23 ++++++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/pandora_console/godmode/setup/setup_auth.php b/pandora_console/godmode/setup/setup_auth.php index 9ba6c00c4f..acd4e99833 100644 --- a/pandora_console/godmode/setup/setup_auth.php +++ b/pandora_console/godmode/setup/setup_auth.php @@ -227,8 +227,7 @@ if (is_ajax()) { $row = []; $row['name'] = __('Force 2FA for all users is enabled'); $row['control'] .= html_print_checkbox_switch( - ' - ', + '2FA_all_users', 1, $config['2FA_all_users'], true @@ -333,13 +332,9 @@ echo ''; $('input[type=checkbox][name=double_auth_enabled]').change(function () { if ($('input[type=checkbox][name=double_auth_enabled]:checked').val() == 1) { $('#table1-2FA_all_users').show(); - $('#table3-2FA_all_users').show(); - $('#table5-2FA_all_users').show(); } else { $('#table1-2FA_all_users').hide(); - $('#table3-2FA_all_users').hide(); - $('#table5-2FA_all_users').hide(); } }).change(); }); diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 23b797a8f2..1e04ad89e0 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -395,7 +395,12 @@ $double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', if ($config['double_auth_enabled']) { $double_authentication = '

'.__('Double authentication').'

'; - $double_authentication .= html_print_checkbox_switch('double_auth', 1, $double_auth_enabled, true); + if ($config['double_auth_enabled']) { + $double_authentication .= html_print_checkbox_switch('double_auth', 1, 1, true); + } else { + $double_authentication .= html_print_checkbox_switch('double_auth', 1, $double_auth_enabled, true); + } + // Dialog. $double_authentication .= ''; } @@ -878,17 +883,19 @@ $(document).ready (function () { $("#text-block_size").removeAttr('disabled'); } } + var fa_enable = $("input#checkbox-double_auth").change(function (e) { e.preventDefault(); + if(fa_enable != 1){ + if (this.checked) { + show_double_auth_activation(); + } else { + show_double_auth_deactivation(); + } + } + }); - if (this.checked) { - show_double_auth_activation(); - } - else { - show_double_auth_deactivation(); - } - }); show_data_section(); });