kompass/modules/LimitLoginAttempts/includes/gui_elements.php

117 lines
3.1 KiB
PHP
Raw Normal View History

2024-02-26 14:47:51 +01:00
<?php
// Callback-Funktion für die Einstellungsseite
function custom_settings_section_callback() {
echo '<input type="hidden" name="update_options" value="true" />';
}
function _kompass_limit_logins_settings_callback($args) {
$setting = get_option($args['setting'], null);
if (null === $setting) {
$setting = '';
}
$value = esc_attr($setting);
if (isset($args['unit_division'])) {
$value = (int)$value / (int)$args['unit_division'];
}
kompass_print_textbox($args['setting'], $value);
}
function _kompass_limit_logins_settings_radio_callback($args)
{
kompass_print_radio($args['setting']);
}
function _kompass_limit_logins_settings_checkbox_callback($args) {
kompass_print_checkbox($args['setting']);
}
add_settings_section(
'custom_settings_section',
'Optionen',
'custom_settings_section_callback',
BDP_LV_PLUGIN_SLUG . '-limit-login-attempts'
);
$settings_page = BDP_LV_PLUGIN_SLUG . '-limit-login-attempts';
add_settings_field(
'kompass_lla_1',
'Maximale Wiederholungen',
'_kompass_limit_logins_settings_callback',
$settings_page,
'custom_settings_section',
['setting' => 'kompass_limit_login_allowed_retries']);
add_settings_field(
'kompass_lla_2',
'Dauer der Sperre (in Minuten)',
'_kompass_limit_logins_settings_callback',
$settings_page,
'custom_settings_section',
['setting' => 'kompass_limit_login_lockout_duration', 'unit_division' => 60 ]);
add_settings_field(
'kompass_lla_3',
'Maximale Anzahl an Sperrungen',
'_kompass_limit_logins_settings_callback',
$settings_page,
'custom_settings_section',
['setting' => 'kompass_limit_login_allowed_lockouts']);
add_settings_field(
'kompass_lla_4',
'Langzeitsperre in Stunden',
'_kompass_limit_logins_settings_callback',
$settings_page,
'custom_settings_section',
['setting' => 'kompass_limit_login_long_duration', 'unit_division' => 3600]);
add_settings_field(
'kompass_lla_5',
'Mininmale Passwort-Stärke:',
'_kompass_limit_logins_settings_radio_callback',
$settings_page,
'custom_settings_section',
['setting' => 'kompass_password_minimal_strength']);
add_settings_field(
'kompass_lla_6',
'Seite erreichbar über:',
'_kompass_limit_logins_settings_radio_callback',
$settings_page,
'custom_settings_section',
['setting' => 'kompass_limit_login_client_type']);
add_settings_field(
'kompass_lla_7',
'Cookies verarbeiten',
'_kompass_limit_logins_settings_radio_callback',
$settings_page,
'custom_settings_section',
['setting' => 'kompass_limit_login_cookies']);
add_settings_field(
'kompass_lla_8',
'Bei Sperrung benachrichtigen',
'_kompass_limit_logins_settings_checkbox_callback',
$settings_page,
'custom_settings_section',
['setting' => 'kompass_limit_login_lockout_notify']);
add_settings_field(
'kompass_lla_9',
'Fehlversuche bis zur Benachrichtigung',
'_kompass_limit_logins_settings_callback',
$settings_page,
'custom_settings_section',
['setting' => 'kompass_limit_login_notify_email_after']);