Exemplo n.º 1
0
 /**
  * Loads in the secure login form, and shows it for pro users
  *
  * @return VOID
  */
 function brute_maybe_use_secure_login()
 {
     global $error;
     if (empty($wp_error)) {
         $wp_error = new WP_Error();
     }
     // In case a plugin uses $error rather than the $wp_errors object
     if (!empty($error)) {
         $wp_error->add('error', $error);
         unset($error);
     }
     // turn off secure login if we're already on ssl or the user has opted for standard login or they had a failed login
     if (isset($_GET['bp_sl_off']) || is_ssl() || $wp_error->get_error_code()) {
         return;
     }
     $response = $this->brute_call('check_key');
     if (!isset($response['privacy_settings'])) {
         // there is no response from the api, don't show secure login
         return;
     }
     // gets the user's most up-to-date account info
     bruteprotect_save_pro_info($response);
     if (!bruteprotect_has_secure_login()) {
         return;
     }
     $site_linked = get_site_option('bruteprotect_user_linked', false);
     if (empty($site_linked)) {
         return;
     }
     $bruteprotect_host = $this->get_bruteprotect_host();
     $local_host = $this->brute_get_local_host();
     $key = get_site_option('bruteprotect_api_key');
     $api_key = md5(get_site_option('bruteprotect_api_key'));
     include 'admin/pro/secure_login/secure_login.php';
 }
Exemplo n.º 2
0
if (isset($response['error'])) {
    if ($response['error'] == 'Invalid API Key') {
        $invalid_key = true;
        $brute_error = 'Sorry, your API Key is invalid';
    }
    if ($response['error'] == 'Host match error') {
        $invalid_key = true;
        // their api key is used on an other site. no error message is required. just prompt them to get a new key
    }
    if ($response['error'] == 'API Key Required') {
        $invalid_key = true;
        // they don't have a key yet. no error message is required.
    }
}
// save info from api
bruteprotect_save_pro_info($response);
$privacy_opt_in = get_site_option('brute_privacy_opt_in');
// load in override styles
?>

	<!-- MOVE THIS INTO SCSS -->
	<style>


	/* override wp ui buttons */

	body.wp-core-ui {
		background: transparent;
	}

	.wp-core-ui .wp-submenu-wrap {
Exemplo n.º 3
0
 function bruteprotect_dashboard_widget()
 {
     $response = $this->brute_call('check_key');
     if (!isset($response['status'])) {
         // we cannot connect to the api, lets not show the stats
         echo '<div style="text-align: center;"><strong>Statistics are currently unavailable.</strong></div>';
         return;
     }
     bruteprotect_save_pro_info($response);
     $key = get_site_option('bruteprotect_api_key');
     $ckval = get_site_option('bruteprotect_ckval');
     $stats = wp_remote_get($this->get_bruteprotect_host() . "index.php/ui/dashboard/index/" . $key);
     if (is_wp_error($stats)) {
         echo '<div style="text-align: center;"><strong>Statistics are currently unavailable.</strong></div>';
         return;
     }
     print_r($stats['body']);
 }