siteguard-login-history-table.php
3 years ago
siteguard-menu-admin-filter.php
3 years ago
siteguard-menu-author-query.php
3 years ago
siteguard-menu-captcha.php
3 years ago
siteguard-menu-dashboard.php
3 years ago
siteguard-menu-fail-once.php
3 years ago
siteguard-menu-init.php
3 years ago
siteguard-menu-login-alert.php
3 years ago
siteguard-menu-login-history.php
3 years ago
siteguard-menu-login-lock.php
3 years ago
siteguard-menu-protect-xmlrpc.php
3 years ago
siteguard-menu-rename-login.php
3 years ago
siteguard-menu-same-error.php
3 years ago
siteguard-menu-updates-notify.php
3 years ago
siteguard-menu-waf-tuning-support.php
3 years ago
siteguard-waf-exclude-rule-table.php
3 years ago
siteguard-menu-same-error.php
98 lines
| 1 | <?php |
| 2 | |
| 3 | class SiteGuard_Menu_Same_Error extends SiteGuard_Base { |
| 4 | const OPT_NAME_ENABLE = 'same_login_error'; |
| 5 | |
| 6 | function __construct() { |
| 7 | $this->render_page(); |
| 8 | } |
| 9 | function render_page() { |
| 10 | global $siteguard_config, $siteguard_captcha; |
| 11 | |
| 12 | $opt_val_enable = $siteguard_config->get( self::OPT_NAME_ENABLE ); |
| 13 | if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-same-error-submit' ) ) { |
| 14 | $error = false; |
| 15 | $errors = siteguard_check_multisite(); |
| 16 | if ( is_wp_error( $errors ) ) { |
| 17 | echo '<div class="error settings-error"><p><strong>'; |
| 18 | echo esc_html( $errors->get_error_message() ); |
| 19 | echo '</strong></p></div>'; |
| 20 | $error = true; |
| 21 | } |
| 22 | if ( false === $error && '1' === $_POST[ self::OPT_NAME_ENABLE ] ) { |
| 23 | $ret = $siteguard_captcha->check_requirements(); |
| 24 | if ( is_wp_error( $ret ) ) { |
| 25 | echo '<div class="error settings-error"><p><strong>' . esc_html( $ret->get_error_message() ) . '</strong></p></div>'; |
| 26 | $error = true; |
| 27 | $siteguard_config->set( self::OPT_NAME_ENABLE, '0' ); |
| 28 | $siteguard_config->update(); |
| 29 | } |
| 30 | } |
| 31 | if ( false === $error && false === $this->is_switch_value( $_POST[ self::OPT_NAME_ENABLE ] ) ) { |
| 32 | echo '<div class="error settings-error"><p><strong>'; |
| 33 | esc_html_e( 'ERROR: Invalid input value.', 'siteguard' ); |
| 34 | echo '</strong></p></div>'; |
| 35 | $error = true; |
| 36 | } |
| 37 | if ( false === $error ) { |
| 38 | $opt_val_enable = sanitize_text_field( $_POST[ self::OPT_NAME_ENABLE ] ); |
| 39 | $siteguard_config->set( self::OPT_NAME_ENABLE, $opt_val_enable ); |
| 40 | $siteguard_config->update(); |
| 41 | ?> |
| 42 | <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div> |
| 43 | <?php |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | echo '<div class="wrap">'; |
| 48 | echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />'; |
| 49 | echo '<h2>' . esc_html__( 'Same Login Error Message', 'siteguard' ) . '</h2>'; |
| 50 | echo '<div class="siteguard-description">' |
| 51 | . esc_html__( 'You can find docs about this function on ', 'siteguard' ) |
| 52 | . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/same_error/', 'siteguard' ) ) |
| 53 | . '" target="_blank">' |
| 54 | . esc_html__( 'here', 'siteguard' ) |
| 55 | . '</a>' |
| 56 | . esc_html__( '.', 'siteguard' ) |
| 57 | . '</div>'; |
| 58 | ?> |
| 59 | <form name="form1" method="post" action=""> |
| 60 | <table class="form-table"> |
| 61 | <tr> |
| 62 | <th scope="row" colspan="2"> |
| 63 | <ul class="siteguard-radios"> |
| 64 | <li> |
| 65 | <input type="radio" name="<?php echo self::OPT_NAME_ENABLE; ?>" id="<?php echo self::OPT_NAME_ENABLE . '_on'; ?>" value="1" <?php checked( $opt_val_enable, '1' ); ?> > |
| 66 | <label for="<?php echo self::OPT_NAME_ENABLE . '_on'; ?>"><?php esc_html_e( 'ON', 'siteguard' ); ?></label> |
| 67 | </li><li> |
| 68 | <input type="radio" name="<?php echo self::OPT_NAME_ENABLE; ?>" id="<?php echo self::OPT_NAME_ENABLE . '_off'; ?>" value="0" <?php checked( $opt_val_enable, '0' ); ?> > |
| 69 | <label for="<?php echo self::OPT_NAME_ENABLE . '_off'; ?>"><?php esc_html_e( 'OFF', 'siteguard' ); ?></label> |
| 70 | </li> |
| 71 | </ul> |
| 72 | <?php |
| 73 | $error = siteguard_check_multisite(); |
| 74 | if ( is_wp_error( $error ) ) { |
| 75 | echo '<p class="description">'; |
| 76 | echo esc_html( $error->get_error_message() ); |
| 77 | echo '</p>'; |
| 78 | } |
| 79 | ?> |
| 80 | </th> |
| 81 | </tr> |
| 82 | </table> |
| 83 | <input type="hidden" name="update" value="Y"> |
| 84 | <div class="siteguard-description"> |
| 85 | <?php esc_html_e( 'It is the function to decrease the vulnerability against the attack to examine if a user name exists. All error messages about the login should be equalized. The single error message is displayed even if anyone of a username, password, or CAPTCHA is wrong.', 'siteguard' ); ?> |
| 86 | </div> |
| 87 | <hr /> |
| 88 | |
| 89 | <?php |
| 90 | wp_nonce_field( 'siteguard-menu-same-error-submit' ); |
| 91 | submit_button(); |
| 92 | ?> |
| 93 | </form> |
| 94 | </div> |
| 95 | <?php |
| 96 | } |
| 97 | } |
| 98 |