<?php




function _kompass_limit_logins_settings_radio_callback(array $args)
{
    kompass_print_radio($args['setting']);
}
function _kompass_limit_logins_settings_checkbox_callback(array $args) {
    kompass_print_checkbox($args['setting']);
}


bdp_kompass_load_plugin_textdomain();
add_settings_section(
    'custom_settings_section',
    __('Options', BDP_LV_PLUGIN_SLUG),
	'kompass_prepare_form',
    BDP_LV_PLUGIN_SLUG . '-limit-login-attempts'
);





$settings_page = BDP_LV_PLUGIN_SLUG . '-limit-login-attempts';



add_settings_field(
	'kompass_lla_1',
    __('Maximum reps until lockout', BDP_LV_PLUGIN_SLUG),
	'kompass_print_textbox',
    $settings_page,
    'custom_settings_section',
    ['setting' => 'kompass_limit_login_allowed_retries']);

add_settings_field(
	'kompass_lla_2',
    __('Duration of lockout (in minutes)', BDP_LV_PLUGIN_SLUG),
	'kompass_print_textbox',
    $settings_page,
    'custom_settings_section',
    ['setting' => 'kompass_limit_login_lockout_duration', 'unit_division' => 60 ]);

add_settings_field(
	'kompass_lla_3',
    __('Maximum number of lockouts', BDP_LV_PLUGIN_SLUG),
	'kompass_print_textbox',
    $settings_page,
    'custom_settings_section',
    ['setting' => 'kompass_limit_login_allowed_lockouts']);

add_settings_field(
	'kompass_lla_4',
    __('Long-term duration (in hours)', BDP_LV_PLUGIN_SLUG),
	'kompass_print_textbox',
    $settings_page,
    'custom_settings_section',
    ['setting' => 'kompass_limit_login_long_duration', 'unit_division' => 3600]);

add_settings_field(
	'kompass_lla_5',
    __('Minimum password strength', BDP_LV_PLUGIN_SLUG),
	'_kompass_limit_logins_settings_radio_callback',
    $settings_page,
    'custom_settings_section',
    ['setting' => 'kompass_password_minimal_strength']);

add_settings_field(
	'kompass_lla_6',
    __('Page accessible via', BDP_LV_PLUGIN_SLUG),
	'_kompass_limit_logins_settings_radio_callback',
    $settings_page,
    'custom_settings_section',
    ['setting' => 'kompass_limit_login_client_type']);

add_settings_field(
	'kompass_lla_7',
    __('Handle cookies', BDP_LV_PLUGIN_SLUG),
	'_kompass_limit_logins_settings_radio_callback',
    $settings_page,
    'custom_settings_section',
    ['setting' => 'kompass_limit_login_cookies']);

add_settings_field(
	'kompass_lla_8',
    __('Notify if blocked', BDP_LV_PLUGIN_SLUG),
	'_kompass_limit_logins_settings_checkbox_callback',
    $settings_page,
    'custom_settings_section',
    ['setting' => 'kompass_limit_login_lockout_notify']);

add_settings_field(
	'kompass_lla_9',
    __('Failed attempts until notification', BDP_LV_PLUGIN_SLUG),
	'kompass_print_textbox',
    $settings_page,
    'custom_settings_section',
    ['setting' => 'kompass_limit_login_notify_email_after']);

