Skip to content

Commit

Permalink
v4.3.9.2 released
Browse files Browse the repository at this point in the history
  • Loading branch information
Amin authored and Amin committed May 14, 2019
1 parent 57c8533 commit b31842a
Show file tree
Hide file tree
Showing 13 changed files with 2,359 additions and 1,052 deletions.
44 changes: 29 additions & 15 deletions all-in-one-wp-security/admin/wp-security-brute-force-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ function render_tab3()
$aio_wp_security->configs->set_value('aiowps_enable_login_captcha',isset($_POST["aiowps_enable_login_captcha"])?'1':'');
$aio_wp_security->configs->set_value('aiowps_enable_woo_login_captcha',isset($_POST["aiowps_enable_woo_login_captcha"])?'1':'');
$aio_wp_security->configs->set_value('aiowps_enable_woo_register_captcha',isset($_POST["aiowps_enable_woo_register_captcha"])?'1':'');
$aio_wp_security->configs->set_value('aiowps_enable_woo_lostpassword_captcha',isset($_POST["aiowps_enable_woo_lostpassword_captcha"])?'1':'');
$aio_wp_security->configs->set_value('aiowps_enable_custom_login_captcha',isset($_POST["aiowps_enable_custom_login_captcha"])?'1':'');
$aio_wp_security->configs->set_value('aiowps_enable_lost_password_captcha',isset($_POST["aiowps_enable_lost_password_captcha"])?'1':'');

Expand Down Expand Up @@ -613,6 +614,25 @@ function render_tab3()
</td>
</tr>
</table>
</div></div>
<div class="postbox">
<h3 class="hndle"><label for="title"><?php _e('Lost Password Form Captcha Settings', 'all-in-one-wp-security-and-firewall'); ?></label></h3>
<div class="inside">
<?php
//Display security info badge
global $aiowps_feature_mgr;
$aiowps_feature_mgr->output_feature_details_badge("lost-password-captcha");
?>

<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e('Enable Captcha On Lost Password Page', 'all-in-one-wp-security-and-firewall')?>:</th>
<td>
<input name="aiowps_enable_lost_password_captcha" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_enable_lost_password_captcha')=='1') echo ' checked="checked"'; ?> value="1"/>
<span class="description"><?php _e('Check this if you want to insert a captcha form on the lost password page', 'all-in-one-wp-security-and-firewall'); ?></span>
</td>
</tr>
</table>
</div></div>
<div class="postbox">
<h3 class="hndle"><label for="title"><?php _e('Custom Login Form Captcha Settings', 'all-in-one-wp-security-and-firewall'); ?></label></h3>
Expand Down Expand Up @@ -651,33 +671,27 @@ function render_tab3()
</table>
<hr>
<?php
$aiowps_feature_mgr->output_feature_details_badge("woo-register-captcha");
$aiowps_feature_mgr->output_feature_details_badge("woo-lostpassword-captcha");
?>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e('Enable Captcha On Woocommerce Registration Form', 'all-in-one-wp-security-and-firewall')?>:</th>
<th scope="row"><?php _e('Enable Captcha On Woocommerce Lost Password Form', 'all-in-one-wp-security-and-firewall')?>:</th>
<td>
<input name="aiowps_enable_woo_register_captcha" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_enable_woo_register_captcha')=='1') echo ' checked="checked"'; ?> value="1"/>
<span class="description"><?php _e('Check this if you want to insert captcha on a Woocommerce registration form', 'all-in-one-wp-security-and-firewall'); ?></span>
<input name="aiowps_enable_woo_lostpassword_captcha" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_enable_woo_lostpassword_captcha')=='1') echo ' checked="checked"'; ?> value="1"/>
<span class="description"><?php _e('Check this if you want to insert captcha on a Woocommerce lost password form', 'all-in-one-wp-security-and-firewall'); ?></span>
</td>
</tr>
</table>
</div></div>
<div class="postbox">
<h3 class="hndle"><label for="title"><?php _e('Lost Password Form Captcha Settings', 'all-in-one-wp-security-and-firewall'); ?></label></h3>
<div class="inside">
<hr>
<?php
//Display security info badge
global $aiowps_feature_mgr;
$aiowps_feature_mgr->output_feature_details_badge("lost-password-captcha");
$aiowps_feature_mgr->output_feature_details_badge("woo-register-captcha");
?>

<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e('Enable Captcha On Lost Password Page', 'all-in-one-wp-security-and-firewall')?>:</th>
<th scope="row"><?php _e('Enable Captcha On Woocommerce Registration Form', 'all-in-one-wp-security-and-firewall')?>:</th>
<td>
<input name="aiowps_enable_lost_password_captcha" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_enable_lost_password_captcha')=='1') echo ' checked="checked"'; ?> value="1"/>
<span class="description"><?php _e('Check this if you want to insert a captcha form on the lost password page', 'all-in-one-wp-security-and-firewall'); ?></span>
<input name="aiowps_enable_woo_register_captcha" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_enable_woo_register_captcha')=='1') echo ' checked="checked"'; ?> value="1"/>
<span class="description"><?php _e('Check this if you want to insert captcha on a Woocommerce registration form', 'all-in-one-wp-security-and-firewall'); ?></span>
</td>
</tr>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function initialize_features()
$this->feature_items[] = new AIOWPSecurity_Feature_Item("user-login-captcha", __("Login Captcha", "all-in-one-wp-security-and-firewall"), $this->feature_point_4, $this->sec_level_basic);
$this->feature_items[] = new AIOWPSecurity_Feature_Item("custom-login-captcha", __("Custom Login Captcha", "all-in-one-wp-security-and-firewall"), $this->feature_point_4, $this->sec_level_basic);
$this->feature_items[] = new AIOWPSecurity_Feature_Item("woo-login-captcha", __("Woo Login Captcha", "all-in-one-wp-security-and-firewall"), $this->feature_point_2, $this->sec_level_basic);
$this->feature_items[] = new AIOWPSecurity_Feature_Item("woo-lostpassword-captcha", __("Woo Lost Password Captcha", "all-in-one-wp-security-and-firewall"), $this->feature_point_2, $this->sec_level_basic);
$this->feature_items[] = new AIOWPSecurity_Feature_Item("woo-register-captcha", __("Woo Register Captcha", "all-in-one-wp-security-and-firewall"), $this->feature_point_2, $this->sec_level_basic);
//Lost Password Captcha
$this->feature_items[] = new AIOWPSecurity_Feature_Item("lost-password-captcha", __("Lost Password Captcha", "all-in-one-wp-security-and-firewall"), $this->feature_point_2, $this->sec_level_basic);
Expand Down Expand Up @@ -203,6 +204,10 @@ function check_and_set_feature_status()
{
$this->check_woo_login_captcha_feature($item);
}
if($item->feature_id == "woo-lostpassword-captcha")
{
$this->check_woo_lostpassword_captcha_feature($item);
}
if($item->feature_id == "woo-register-captcha")
{
$this->check_woo_register_captcha_feature($item);
Expand Down Expand Up @@ -458,6 +463,18 @@ function check_woo_login_captcha_feature($item)
}
}

function check_woo_lostpassword_captcha_feature($item)
{
global $aio_wp_security;
if ($aio_wp_security->configs->get_value('aiowps_enable_woo_lostpassword_captcha') == '1') {
$item->set_feature_status($this->feature_active);
}
else
{
$item->set_feature_status($this->feature_inactive);
}
}

function check_woo_register_captcha_feature($item)
{
global $aio_wp_security;
Expand Down
15 changes: 8 additions & 7 deletions all-in-one-wp-security/classes/wp-security-captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,15 @@ function number_word_mapping($num)


/**
* Will return TRUE if there is correct answer or if there is no captcha.
* Returns FALSE on wrong captcha result.
* Verifies the math or Google recaptcha v2 forms
* Returns TRUE if correct answer.
* Returns FALSE on wrong captcha result or missing data.
* @global type $aio_wp_security
* @return boolean
*/
function maybe_verify_captcha () {
function verify_captcha_submit () {
global $aio_wp_security;
if($aio_wp_security->configs->get_value('aiowps_enable_login_captcha') && $aio_wp_security->configs->get_value('aiowps_default_recaptcha')){
if($aio_wp_security->configs->get_value('aiowps_default_recaptcha')){
//Google reCaptcha enabled
if (array_key_exists('g-recaptcha-response', $_POST)) {
$g_recaptcha_response = isset($_POST['g-recaptcha-response'])?sanitize_text_field($_POST['g-recaptcha-response']):'';
Expand All @@ -162,11 +163,11 @@ function maybe_verify_captcha () {
return false; // wrong answer was entered
}
}else {
//no captcha form data submitted
// Expected captcha field in $_POST but got none!
return false;
}
}else if($aio_wp_security->configs->get_value('aiowps_enable_login_captcha')) {
// this means basic math captcha is enabled
// math captcha is enabled
if (array_key_exists('aiowps-captcha-answer', $_POST)) {
$captcha_answer = isset($_POST['aiowps-captcha-answer'])?sanitize_text_field($_POST['aiowps-captcha-answer']):'';

Expand All @@ -175,7 +176,7 @@ function maybe_verify_captcha () {
return false; // wrong answer was entered
}
} else {
//no captcha form data submitted
// Expected captcha field in $_POST but got none!
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ static function set_default_settings()
$aio_wp_security->configs->set_value('aiowps_enable_login_captcha','');//Checkbox
$aio_wp_security->configs->set_value('aiowps_enable_custom_login_captcha','');//Checkbox
$aio_wp_security->configs->set_value('aiowps_enable_woo_login_captcha','');//Checkbox
$aio_wp_security->configs->set_value('aiowps_enable_woo_lostpassword_captcha','');//Checkbox
$aio_wp_security->configs->set_value('aiowps_enable_woo_register_captcha','');//Checkbox
$aio_wp_security->configs->set_value('aiowps_enable_lost_password_captcha','');//Checkbox
$aio_wp_security->configs->set_value('aiowps_captcha_secret_key',AIOWPSecurity_Utility::generate_alpha_numeric_random_string(20));//Hidden secret value which will be used to do some captcha processing. This will be assigned a random string generated when captcha settings saved
Expand Down Expand Up @@ -203,6 +204,7 @@ static function add_option_values()
$aio_wp_security->configs->add_value('aiowps_enable_custom_login_captcha','');//Checkbox
$aio_wp_security->configs->add_value('aiowps_enable_woo_login_captcha','');//Checkbox
$aio_wp_security->configs->add_value('aiowps_enable_woo_register_captcha','');//Checkbox
$aio_wp_security->configs->add_value('aiowps_enable_woo_lostpassword_captcha','');//Checkbox
$aio_wp_security->configs->add_value('aiowps_captcha_secret_key',AIOWPSecurity_Utility::generate_alpha_numeric_random_string(20));//Hidden secret value which will be used to do some captcha processing. This will be assigned a random string generated when captcha settings saved

//User registration
Expand Down
Loading

0 comments on commit b31842a

Please sign in to comment.