Skip to content

Commit

Permalink
Fix body param name
Browse files Browse the repository at this point in the history
  • Loading branch information
forgetso committed Mar 12, 2024
1 parent 3a4aa1d commit bc5241d
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/php/Avada/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function verify( $demo_mode ) {
[];

$form_data = wp_parse_args( str_replace( '&', '&', $form_data ) );
$procaptcha_response = $form_data['pro-captcha-response'] ?? '';
$procaptcha_response = $form_data['procaptcha-response'] ?? '';
$_POST['procaptcha-widget-id'] = $form_data['procaptcha-widget-id'] ?? '';
// phpcs:disable WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Missing

Expand Down
2 changes: 1 addition & 1 deletion src/php/BackInStockNotifier/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function after_submit_button( int $product_id, int $variation_id ) {
*/
public function verify( array $post_data, bool $rest_api ) {

$procaptcha_response = $post_data['pro-captcha-response'] ?? '';
$procaptcha_response = $post_data['procaptcha-response'] ?? '';

$result = procaptcha_request_verify( $procaptcha_response );

Expand Down
2 changes: 1 addition & 1 deletion src/php/Brizy/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function verify( $form ) {
continue;
}

if ( 'g-recaptcha-response' === $item['name'] || 'pro-captcha-response' === $item['name'] ) {
if ( 'g-recaptcha-response' === $item['name'] || 'procaptcha-response' === $item['name'] ) {
$procaptcha_response = $item['value'];
}

Expand Down
4 changes: 2 additions & 2 deletions src/php/ElementorPro/PCaptchaHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ public function validation( Form_Record $record, Ajax_Handler $ajax_handler ) {
$field = current( $fields );

// phpcs:disable WordPress.Security.NonceVerification.Missing
$procaptcha_response = isset( $_POST['pro-captcha-response'] ) ?
filter_var( wp_unslash( $_POST['pro-captcha-response'] ), FILTER_SANITIZE_FULL_SPECIAL_CHARS ) :
$procaptcha_response = isset( $_POST['procaptcha-response'] ) ?
filter_var( wp_unslash( $_POST['procaptcha-response'] ), FILTER_SANITIZE_FULL_SPECIAL_CHARS ) :
'';
// phpcs:enable WordPress.Security.NonceVerification.Missing

Expand Down
6 changes: 3 additions & 3 deletions src/php/FluentForm/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ public function add_captcha( array $submit_button, stdClass $form ) {
public function verify( array $errors, array $data, FluentForm $form, array $fields ): array {
remove_filter( 'pre_http_request', [ $this, 'pre_http_request' ] );

$procaptcha_response = $data['pro-captcha-response'] ?? '';
$procaptcha_response = $data['procaptcha-response'] ?? '';
$_POST['procaptcha-widget-id'] = $data['procaptcha-widget-id'] ?? '';
$error_message = procaptcha_request_verify( $procaptcha_response );

if ( null !== $error_message ) {
$errors['pro-captcha-response'] = [ $error_message ];
$errors['procaptcha-response'] = [ $error_message ];
}

return $errors;
Expand Down Expand Up @@ -378,7 +378,7 @@ private function get_procaptcha_wrapped(): string {
?>
<div class="ff-el-group">
<div class="ff-el-input--content">
<div data-fluent_id="1" name="pro-captcha-response">
<div data-fluent_id="1" name="procaptcha-response">
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $this->get_captcha();
Expand Down
6 changes: 3 additions & 3 deletions src/php/Kadence/AdvancedForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ public function process_ajax() {
// Nonce is checked by Kadence.

// phpcs:disable WordPress.Security.NonceVerification.Missing
$procaptcha_response = isset( $_POST['pro-captcha-response'] ) ?
filter_var( wp_unslash( $_POST['pro-captcha-response'] ), FILTER_SANITIZE_FULL_SPECIAL_CHARS ) :
$procaptcha_response = isset( $_POST['procaptcha-response'] ) ?
filter_var( wp_unslash( $_POST['procaptcha-response'] ), FILTER_SANITIZE_FULL_SPECIAL_CHARS ) :
'';

$error = procaptcha_request_verify( $procaptcha_response );
Expand All @@ -134,7 +134,7 @@ public function process_ajax() {
return;
}

unset( $_POST['pro-captcha-response'], $_POST['g-recaptcha-response'] );
unset( $_POST['procaptcha-response'], $_POST['g-recaptcha-response'] );
// phpcs:enable WordPress.Security.NonceVerification.Missing

$data = [
Expand Down
6 changes: 3 additions & 3 deletions src/php/Kadence/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public function process_ajax() {
// Nonce is checked by Kadence.

// phpcs:disable WordPress.Security.NonceVerification.Missing
$procaptcha_response = isset( $_POST['pro-captcha-response'] ) ?
filter_var( wp_unslash( $_POST['pro-captcha-response'] ), FILTER_SANITIZE_FULL_SPECIAL_CHARS ) :
$procaptcha_response = isset( $_POST['procaptcha-response'] ) ?
filter_var( wp_unslash( $_POST['procaptcha-response'] ), FILTER_SANITIZE_FULL_SPECIAL_CHARS ) :
'';

$error = procaptcha_request_verify( $procaptcha_response );
Expand All @@ -107,7 +107,7 @@ public function process_ajax() {
return;
}

unset( $_POST['pro-captcha-response'], $_POST['g-recaptcha-response'] );
unset( $_POST['procaptcha-response'], $_POST['g-recaptcha-response'] );
// phpcs:enable WordPress.Security.NonceVerification.Missing

$data = [
Expand Down
4 changes: 2 additions & 2 deletions src/php/Settings/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,8 @@ static function ( $secret_key ) use ( $ajax_secret_key ) {
$this->send_check_config_error( $error );
}

$procaptcha_response = isset( $_POST['pro-captcha-response'] ) ?
filter_var( wp_unslash( $_POST['pro-captcha-response'] ), FILTER_SANITIZE_FULL_SPECIAL_CHARS ) :
$procaptcha_response = isset( $_POST['procaptcha-response'] ) ?
filter_var( wp_unslash( $_POST['procaptcha-response'] ), FILTER_SANITIZE_FULL_SPECIAL_CHARS ) :
'';

$result = procaptcha_request_verify( $procaptcha_response );
Expand Down
4 changes: 2 additions & 2 deletions src/php/SimpleDownloadMonitor/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ public function verify() {
}

// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash
$_POST['pro-captcha-response'] = $_GET['pro-captcha-response'] ?? '';
$_POST['procaptcha-response'] = $_GET['procaptcha-response'] ?? '';
$_POST[ self::NONCE ] = $_GET[ self::NONCE ] ?? '';
// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash

$error_message = procaptcha_verify_post( self::NONCE, self::ACTION );

unset( $_POST['pro-captcha-response'], $_POST[ self::NONCE ] );
unset( $_POST['procaptcha-response'], $_POST[ self::NONCE ] );

if ( null === $error_message ) {
return;
Expand Down
6 changes: 3 additions & 3 deletions src/php/WPDiscuz/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public function verify( $comment_data ) {
// Nonce is checked by wpDiscuz.

// phpcs:disable WordPress.Security.NonceVerification.Missing
$procaptcha_response = isset( $_POST['pro-captcha-response'] ) ?
filter_var( wp_unslash( $_POST['pro-captcha-response'] ), FILTER_SANITIZE_FULL_SPECIAL_CHARS ) :
$procaptcha_response = isset( $_POST['procaptcha-response'] ) ?
filter_var( wp_unslash( $_POST['procaptcha-response'] ), FILTER_SANITIZE_FULL_SPECIAL_CHARS ) :
'';

$result = procaptcha_request_verify( $procaptcha_response );
Expand All @@ -89,7 +89,7 @@ public function verify( $comment_data ) {
return $comment_data;
}

unset( $_POST['pro-captcha-response'], $_POST['g-recaptcha-response'] );
unset( $_POST['procaptcha-response'], $_POST['g-recaptcha-response'] );
// phpcs:enable WordPress.Security.NonceVerification.Missing

wp_die( esc_html( $result ) );
Expand Down
6 changes: 3 additions & 3 deletions src/php/WPDiscuz/Subscribe.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ public function verify() {
// Nonce is checked by wpDiscuz.

// phpcs:disable WordPress.Security.NonceVerification.Missing
$procaptcha_response = isset( $_POST['pro-captcha-response'] ) ?
filter_var( wp_unslash( $_POST['pro-captcha-response'] ), FILTER_SANITIZE_FULL_SPECIAL_CHARS ) :
$procaptcha_response = isset( $_POST['procaptcha-response'] ) ?
filter_var( wp_unslash( $_POST['procaptcha-response'] ), FILTER_SANITIZE_FULL_SPECIAL_CHARS ) :
'';

$result = procaptcha_request_verify( $procaptcha_response );

unset( $_POST['pro-captcha-response'], $_POST['g-recaptcha-response'] );
unset( $_POST['procaptcha-response'], $_POST['g-recaptcha-response'] );
// phpcs:enable WordPress.Security.NonceVerification.Missing

if ( null === $result ) {
Expand Down
4 changes: 2 additions & 2 deletions src/php/includes/request.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ function procaptcha_request_verify( $procaptcha_response ) {
*/
function procaptcha_verify_post( string $nonce_field_name = PROCAPTCHA_NONCE, string $nonce_action_name = PROCAPTCHA_ACTION ) {

$procaptcha_response = isset( $_POST['pro-captcha-response'] ) ?
filter_var( wp_unslash( $_POST['pro-captcha-response'] ), FILTER_SANITIZE_FULL_SPECIAL_CHARS ) :
$procaptcha_response = isset( $_POST['procaptcha-response'] ) ?
filter_var( wp_unslash( $_POST['procaptcha-response'] ), FILTER_SANITIZE_FULL_SPECIAL_CHARS ) :
'';

$procaptcha_nonce = isset( $_POST[ $nonce_field_name ] ) ?
Expand Down

0 comments on commit bc5241d

Please sign in to comment.