feature 2FA_all_users

This commit is contained in:
marcos 2020-10-05 12:29:51 +02:00
parent f8666adf0f
commit e5fe9d5c29
2 changed files with 16 additions and 14 deletions

View File

@ -227,8 +227,7 @@ if (is_ajax()) {
$row = []; $row = [];
$row['name'] = __('Force 2FA for all users is enabled'); $row['name'] = __('Force 2FA for all users is enabled');
$row['control'] .= html_print_checkbox_switch( $row['control'] .= html_print_checkbox_switch(
' '2FA_all_users',
',
1, 1,
$config['2FA_all_users'], $config['2FA_all_users'],
true true
@ -333,13 +332,9 @@ echo '</form>';
$('input[type=checkbox][name=double_auth_enabled]').change(function () { $('input[type=checkbox][name=double_auth_enabled]').change(function () {
if ($('input[type=checkbox][name=double_auth_enabled]:checked').val() == 1) { if ($('input[type=checkbox][name=double_auth_enabled]:checked').val() == 1) {
$('#table1-2FA_all_users').show(); $('#table1-2FA_all_users').show();
$('#table3-2FA_all_users').show();
$('#table5-2FA_all_users').show();
} }
else { else {
$('#table1-2FA_all_users').hide(); $('#table1-2FA_all_users').hide();
$('#table3-2FA_all_users').hide();
$('#table5-2FA_all_users').hide();
} }
}).change(); }).change();
}); });

View File

@ -395,7 +395,12 @@ $double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user',
if ($config['double_auth_enabled']) { if ($config['double_auth_enabled']) {
$double_authentication = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Double authentication').'</p>'; $double_authentication = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Double authentication').'</p>';
$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. // Dialog.
$double_authentication .= '<div id="dialog-double_auth" style="display:none"><div id="dialog-double_auth-container"></div></div>'; $double_authentication .= '<div id="dialog-double_auth" style="display:none"><div id="dialog-double_auth-container"></div></div>';
} }
@ -878,17 +883,19 @@ $(document).ready (function () {
$("#text-block_size").removeAttr('disabled'); $("#text-block_size").removeAttr('disabled');
} }
} }
var fa_enable = <?php echo $config['2FA_all_users']; ?>
$("input#checkbox-double_auth").change(function (e) { $("input#checkbox-double_auth").change(function (e) {
e.preventDefault(); 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(); show_data_section();
}); });