Plugin Directory

Changeset 3432651


Ignore:
Timestamp:
01/05/2026 10:51:21 AM (3 months ago)
Author:
alphanetbd
Message:

woocomerce guest checkout nonce verification fixed

Location:
alpha-sms
Files:
40 added
5 edited

Legend:

Unmodified
Added
Removed
  • alpha-sms/trunk/README.txt

    r3424529 r3432651  
    55Tested up to: 6.9
    66Requires PHP: 5.6
    7 Stable tag: 1.0.15
     7Stable tag: 1.0.16
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • alpha-sms/trunk/alpha_sms.php

    r3424529 r3432651  
    1717 * Plugin URI:        https://sms.net.bd/plugins/wordpress
    1818 * Description:       WP 2FA Login. SMS OTP Verification for Registration and Login forms, WooCommerce SMS Notification for your shop orders.
    19  * Version:           1.0.15
     19 * Version:           1.0.16
    2020 * Author:            Alpha Net
    2121 * Author URI:        https://sms.net.bd/
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define('ALPHA_SMS_VERSION', '1.0.15');
     38define('ALPHA_SMS_VERSION', '1.0.16');
    3939
    4040// plugin constants
  • alpha-sms/trunk/includes/class-alpha_sms.php

    r3424529 r3432651  
    7777            $this->version = ALPHA_SMS_VERSION;
    7878        } else {
    79             $this->version = '1.0.15';
     79            $this->version = '1.0.16';
    8080        }
    8181        $this->plugin_name = 'alpha_sms';
  • alpha-sms/trunk/public/class-alpha_sms-public.php

    r3427389 r3432651  
    143143                [
    144144                    'ajaxurl' => admin_url('admin-ajax.php'),
    145                     $this->plugin_name . '_checkout_nonce' => wp_create_nonce('woocommerce-process-checkout-nonce'),
     145                    $this->plugin_name . '_checkout_nonce' => wp_create_nonce('alpha_sms_checkout_otp'),
    146146                    'checkout_otp' => ! empty($this->options['otp_checkout']) ? 'yes' : 'no',
    147147                ]
     
    256256        // Guest checkout / other actions that rely on WooCommerce checkout nonce
    257257        if ($action_type === 'wc_checkout') {
    258             $wc_checkout_nonce = isset($_POST['woocommerce-process-checkout-nonce']) ? sanitize_text_field(wp_unslash($_POST['woocommerce-process-checkout-nonce'])) : '';
    259             if (empty($wc_checkout_nonce) || ! wp_verify_nonce($wc_checkout_nonce, 'woocommerce-process-checkout-nonce')) {
    260                 $response = [
    261                     'status'  => 403,
    262                     'message' => __('Security Check failed. Please reload the page and try again.', 'alpha-sms'),
    263                 ];
    264                 echo wp_kses_post(json_encode($response));
    265                 wp_die();
    266                 exit;
    267             }
     258            check_ajax_referer('alpha_sms_checkout_otp', 'alpha_sms_checkout_nonce');
     259
    268260            $nonce_ok = true;
    269261        }
  • alpha-sms/trunk/public/js/alpha_sms-public.js

    r3424529 r3432651  
    3333
    3434
    35    initializeCheckoutSubmitProxy();
     35   if(alpha_sms_object.checkout_otp == 'yes'){
     36      initializeCheckoutSubmitProxy();
     37   }
    3638   $(document.body).on('updated_checkout', initializeCheckoutSubmitProxy);
    3739});
     
    102104      .fail(() =>
    103105         alert_wrapper.html(
    104             showError('Something went wrong. Please try again later')
     106            showError('OTP verification request failed. Please try again later')
    105107         )
    106108      )
     
    212214      billing_phone: phone,
    213215      action_type: checkout_form.find('#action_type').val(),
     216      alpha_sms_checkout_nonce: alpha_sms_object.alpha_sms_checkout_nonce
    214217   };
    215    // include checkout nonce if present
    216    const checkoutNonceField = checkout_form.find('input[name="woocommerce-process-checkout-nonce"]');
    217    if (checkoutNonceField && checkoutNonceField.length) {
    218       data['woocommerce-process-checkout-nonce'] = checkoutNonceField.val();
    219    }
     218
    220219
    221220   $.post(
Note: See TracChangeset for help on using the changeset viewer.