F2 feature

This commit is contained in:
marcos 2020-09-30 14:20:57 +02:00
parent 1a2f14a35b
commit f8666adf0f
2 changed files with 35 additions and 0 deletions

View File

@ -221,6 +221,20 @@ if (is_ajax()) {
);
$table->data['double_auth_enabled'] = $row;
// Enable 2FA for all users.
// Set default value.
set_unless_defined($config['2FA_all_users'], false);
$row = [];
$row['name'] = __('Force 2FA for all users is enabled');
$row['control'] .= html_print_checkbox_switch(
'
',
1,
$config['2FA_all_users'],
true
);
$table->data['2FA_all_users'] = $row;
// Session timeout.
// Default session timeout.
set_when_empty($config['session_timeout'], 90);
@ -313,6 +327,23 @@ echo '</form>';
?>
<script type="text/javascript">
$( document ).ready(function() {
//For change autocreate remote users
$('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();
});
$('#auth').on('change', function(){
type_auth = $('#auth').val();
$.ajax({

View File

@ -717,6 +717,10 @@ function config_update_config()
$error_update[] = __('Double authentication');
}
if (!config_update_value('2FA_all_users', get_parameter('2FA_all_users'))) {
$error_update[] = __('2FA all users');
}
if (!config_update_value('session_timeout', get_parameter('session_timeout'))) {
$error_update[] = __('Session timeout');
}