Protection of WordPress logins
This commit is contained in:
		
							
								
								
									
										29
									
								
								modules/LimitLoginAttempts/Views/checkbox-option.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								modules/LimitLoginAttempts/Views/checkbox-option.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
<?php
 | 
			
		||||
function kompass_print_checkbox($settingName) {
 | 
			
		||||
    $currentSetting = get_option($settingName, []);
 | 
			
		||||
	if (!is_array($currentSetting)) {
 | 
			
		||||
		$currentSetting = [$currentSetting];
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    $options = ['kompass_limit_login_lockout_notify' => [
 | 
			
		||||
        'email' => 'E-Mail an Administrator'
 | 
			
		||||
        ],
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    if(!isset($options[$settingName])) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $setting = $options[$settingName];
 | 
			
		||||
    foreach ($setting as $radioOption => $optionText) {
 | 
			
		||||
		$isChecked = in_array($radioOption, $currentSetting) ? 'checked ' : '' ;
 | 
			
		||||
 | 
			
		||||
        echo '<input ' .
 | 
			
		||||
            $isChecked .
 | 
			
		||||
            'type="checkbox" 
 | 
			
		||||
            name="' . $settingName . '[]" 
 | 
			
		||||
            value="' . $radioOption . '"
 | 
			
		||||
            id="setting_' . $settingName . '_' . $radioOption . '" />' .
 | 
			
		||||
            '<label for="setting_' . $settingName . '_' . $radioOption . '">' . $optionText . '</label><br />';
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										35
									
								
								modules/LimitLoginAttempts/Views/radio-option.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								modules/LimitLoginAttempts/Views/radio-option.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
<?php
 | 
			
		||||
function kompass_print_radio($settingName) {
 | 
			
		||||
    $currentSetting = get_option($settingName);
 | 
			
		||||
    $options = [
 | 
			
		||||
        'kompass_limit_login_client_type' => [
 | 
			
		||||
            'REMOTE_ADDR' => 'Direkte Verbrindung',
 | 
			
		||||
            'HTTP_X_FORWARDED_FOR' => 'Hinter einem Proxy'
 | 
			
		||||
        ],
 | 
			
		||||
        'kompass_limit_login_cookies' => [
 | 
			
		||||
            true => 'Ja',
 | 
			
		||||
            false => 'Nein'
 | 
			
		||||
        ],
 | 
			
		||||
        'kompass_password_minimal_strength' => [
 | 
			
		||||
            '1' => 'Alle Passwörter erlauben',
 | 
			
		||||
            '2' => 'Mittelstarke Passwörter',
 | 
			
		||||
            '3' => 'Nur Starke Passwörter'
 | 
			
		||||
        ]
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    if(!isset($options[$settingName])) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $setting = $options[$settingName];
 | 
			
		||||
    foreach ($setting as $radioOption  => $optionText) {
 | 
			
		||||
        $isChecked = $currentSetting == $radioOption ? 'checked ' : '' ;
 | 
			
		||||
        echo '<input  
 | 
			
		||||
            ' . $isChecked .
 | 
			
		||||
            ' type="radio"
 | 
			
		||||
              name="' . $settingName . '"
 | 
			
		||||
              value="' . $radioOption . '" 
 | 
			
		||||
              id="setting_' . $settingName . '_' . $radioOption . '" />' .
 | 
			
		||||
            '<label for="setting_' . $settingName . '_' . $radioOption . '">' . $optionText . '</label>   ';
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										18
									
								
								modules/LimitLoginAttempts/Views/tab-control.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								modules/LimitLoginAttempts/Views/tab-control.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
<?php
 | 
			
		||||
    function kompass_print_tab_header($activeTab = 'tab1')
 | 
			
		||||
    {
 | 
			
		||||
        $baseUrl = 'admin.php?page=bdp-kompass-limit-login-attempts&tab=';
 | 
			
		||||
        return '<h2 class="nav-tab-wrapper">'.
 | 
			
		||||
        '<a href="' . $baseUrl . 'tab1" class="nav-tab ' . ($activeTab == 'tab1' ? 'nav-tab-active' : '') . '">
 | 
			
		||||
            Optionen
 | 
			
		||||
        </a>'.
 | 
			
		||||
        '<a href="' . $baseUrl . 'tab2" class="nav-tab ' . ($activeTab == 'tab2' ? 'nav-tab-active' : '') .'">
 | 
			
		||||
            Blocklist
 | 
			
		||||
        </a>'.
 | 
			
		||||
        '<a href="' . $baseUrl . 'tab3" class="nav-tab ' . ($activeTab == 'tab3' ? 'nav-tab-active' : '') .'">
 | 
			
		||||
            Allowlist
 | 
			
		||||
        </a>'.
 | 
			
		||||
        '<a href="' . $baseUrl . 'tab4" class="nav-tab ' . ($activeTab == 'tab4' ? 'nav-tab-active' : '') .'">
 | 
			
		||||
            Gesperrte IPs
 | 
			
		||||
        </a></h2>';
 | 
			
		||||
    }
 | 
			
		||||
							
								
								
									
										7
									
								
								modules/LimitLoginAttempts/Views/text-element.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								modules/LimitLoginAttempts/Views/text-element.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
<?php
 | 
			
		||||
function kompass_print_textbox($settingName, $settingValue) {
 | 
			
		||||
    echo '<input type="text" name="' . $settingName . '" value="' . $settingValue. '" />';
 | 
			
		||||
    if (defined('WP_DEBUG') && WP_DEBUG == true) {
 | 
			
		||||
        echo '<br />' . $settingName;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user