PluginProbe ʕ •ᴥ•ʔ
SiteGuard WP Plugin / 1.8.7
SiteGuard WP Plugin v1.8.7
1.8.7 1.8.6 1.8.6-beta1 1.8.6-beta2 1.8.4 1.8.5 1.8.3 1.8.2 1.8.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.4.3 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.7.0 1.7.1 1.7.10 1.7.11 1.7.12 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.0-beta1 1.8.0-beta2 1.8.0-beta3 1.8.0-beta4
siteguard / admin / siteguard-menu-fail-once.php
siteguard / admin Last commit date
siteguard-login-history-table.php 1 month ago siteguard-menu-admin-filter.php 4 weeks ago siteguard-menu-author-query.php 2 weeks ago siteguard-menu-captcha.php 4 weeks ago siteguard-menu-dashboard.php 4 weeks ago siteguard-menu-fail-once.php 4 weeks ago siteguard-menu-init.php 1 month ago siteguard-menu-login-alert.php 4 weeks ago siteguard-menu-login-history.php 4 weeks ago siteguard-menu-login-lock.php 4 weeks ago siteguard-menu-protect-xmlrpc.php 4 weeks ago siteguard-menu-rename-login.php 2 weeks ago siteguard-menu-same-error.php 4 weeks ago siteguard-menu-updates-notify.php 4 weeks ago siteguard-menu-waf-tuning-support.php 4 weeks ago siteguard-waf-exclude-rule-table.php 1 month ago
siteguard-menu-fail-once.php
106 lines
1 <?php
2
3 class SiteGuard_Menu_Fail_Once extends SiteGuard_Base {
4 const OPT_NAME_FAIL_ONCE = 'loginlock_fail_once';
5 const OPT_NAME_ADMIN_ONLY = 'fail_once_admin_only';
6
7 function __construct() {
8 $this->render_page();
9 }
10 function render_page() {
11 global $siteguard_config;
12
13 $opt_val_fail_once = $siteguard_config->get( self::OPT_NAME_FAIL_ONCE );
14 $opt_val_admin_only = $siteguard_config->get( self::OPT_NAME_ADMIN_ONLY );
15 if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-fail-once-submit' ) ) {
16 $error = false;
17 $errors = siteguard_check_multisite();
18 if ( is_wp_error( $errors ) ) {
19 echo '<div class="error settings-error"><p><strong>';
20 echo esc_html( $errors->get_error_message() );
21 echo '</strong></p></div>';
22 $error = true;
23 }
24 if ( false === $error && false === $this->is_switch_value( $_POST[ self::OPT_NAME_FAIL_ONCE ] ) ) {
25 echo '<div class="error settings-error"><p><strong>';
26 esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
27 echo '</strong></p></div>';
28 $error = true;
29 }
30 if ( false === $error ) {
31 $opt_val_fail_once = sanitize_text_field( $_POST[ self::OPT_NAME_FAIL_ONCE ] );
32 if ( isset( $_POST[ self::OPT_NAME_ADMIN_ONLY ] ) ) {
33 $opt_val_admin_only = '1';
34 } else {
35 $opt_val_admin_only = '0';
36 }
37 $siteguard_config->set( self::OPT_NAME_FAIL_ONCE, $opt_val_fail_once );
38 $siteguard_config->set( self::OPT_NAME_ADMIN_ONLY, $opt_val_admin_only );
39 $siteguard_config->update();
40 ?>
41 <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
42 <?php
43 }
44 }
45
46 echo '<div class="wrap">';
47 echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
48 echo '<h2>' . esc_html__( 'Fail Once', 'siteguard' ) . '</h2>';
49 $documentation_link = '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/fail_once/', 'siteguard' ) ) . '" target="_blank">' . esc_html__( 'online documentation', 'siteguard' ) . '</a>';
50 echo '<div class="siteguard-description">'
51 . sprintf(
52 /* translators: %1$s: Link to the online documentation. */
53 esc_html__( 'See the %1$s.', 'siteguard' ),
54 $documentation_link
55 )
56 . '</div>';
57 ?>
58 <form name="form1" method="post" action="">
59 <table class="form-table">
60 <tr>
61 <th scope="row" colspan="2">
62 <ul class="siteguard-radios">
63 <li>
64 <input type="radio" name="<?php echo self::OPT_NAME_FAIL_ONCE; ?>" id="<?php echo self::OPT_NAME_FAIL_ONCE . '_on'; ?>" value="1" <?php checked( $opt_val_fail_once, '1' ); ?> >
65 <label for="<?php echo self::OPT_NAME_FAIL_ONCE . '_on'; ?>"><?php esc_html_e( 'ON', 'siteguard' ); ?></label>
66 </li><li>
67 <input type="radio" name="<?php echo self::OPT_NAME_FAIL_ONCE; ?>" id="<?php echo self::OPT_NAME_FAIL_ONCE . '_off'; ?>" value="0" <?php checked( $opt_val_fail_once, '0' ); ?> >
68 <label for="<?php echo self::OPT_NAME_FAIL_ONCE . '_off'; ?>"><?php esc_html_e( 'OFF', 'siteguard' ); ?></label>
69 </li>
70 </ul>
71 <?php
72 $error = siteguard_check_multisite();
73 if ( is_wp_error( $error ) ) {
74 echo '<p class="description">';
75 echo esc_html( $error->get_error_message() );
76 echo '</p>';
77 }
78 ?>
79 </th>
80 <td>
81 </tr><tr>
82 <th scope="row"><?php esc_html_e( 'Target user', 'siteguard' ); ?></th>
83 <td>
84 <input type="checkbox" name="<?php echo self::OPT_NAME_ADMIN_ONLY; ?>" id="<?php echo self::OPT_NAME_ADMIN_ONLY; ?>" value="1" <?php checked( $opt_val_admin_only, '1' ); ?> >
85 <label for="<?php echo self::OPT_NAME_ADMIN_ONLY; ?>"><?php esc_html_e( 'Admin only', 'siteguard' ); ?></label>
86 </td>
87 </tr>
88 </table>
89 <input type="hidden" name="update" value="Y">
90 <div class="siteguard-description">
91 <?php esc_html_e( 'Reduces the risk of password list attacks by forcing the first valid login attempt to fail. After the first failure, the user must try again between 5 and 60 seconds later with the correct credentials.', 'siteguard' ); ?>
92 </div>
93 <hr />
94
95 <?php
96 wp_nonce_field( 'siteguard-menu-fail-once-submit' );
97 submit_button();
98 ?>
99
100 </form>
101 </div>
102
103 <?php
104 }
105 }
106