id = 'network-brute-force'; $this->title = __( 'Network Brute Force Protection', 'better-wp-security' ); $this->description = __( 'Join a network of sites that reports and protects against bad actors on the internet.', 'better-wp-security' ); $this->type = 'recommended'; parent::__construct(); } public function enqueue_scripts_and_styles() { $settings = ITSEC_Modules::get_settings( $this->id ); $vars = array( 'resetting_button_text' => __( 'Resetting...', 'better-wp-security' ), ); wp_enqueue_script( 'itsec-network-brute-force-settings-page-script', plugins_url( 'js/settings-page.js', __FILE__ ), array( 'jquery' ), $this->script_version, true ); wp_localize_script( 'itsec-network-brute-force-settings-page-script', 'itsec_network_brute_force', $vars ); } public function handle_ajax_request( $data ) { if ( 'reset-api-key' === $data['method'] ) { $defaults = ITSEC_Modules::get_defaults( $this->id ); $results = ITSEC_Modules::set_settings( $this->id, $defaults ); ITSEC_Response::set_response( $results['saved'] ); ITSEC_Response::add_errors( $results['errors'] ); ITSEC_Response::add_messages( $results['messages'] ); if ( $results['saved'] ) { ITSEC_Response::reload_module( $this->id ); } else if ( empty( $results['errors'] ) ) { ITSEC_Response::add_error( new WP_Error( 'itsec-network-brute-force-settings-page-handle-ajax-request-bad-response', __( 'An unknown error prevented the API key from being reset properly. An unrecognized response was received. Please wait a few minutes and try again.', 'better-wp-security' ) ) ); } } } protected function render_description( $form ) { ?>

get_options(); ?>



add_text( 'email', array( 'class' => 'regular-text', 'value' => get_option( 'admin_email' ) ) ); ?>
add_checkbox( 'updates_optin' ); ?>
add_text( 'api_key', array( 'class' => 'regular-text code', 'readonly' => 'readonly' ) ); ?> add_button( 'reset_api_key', array( 'value' => __( 'Reset API Key', 'better-wp-security' ), 'class' => 'button-primary' ) ); ?>
add_checkbox( 'enable_ban' ); ?>