Plugin Directory

Changeset 3463125


Ignore:
Timestamp:
02/17/2026 06:42:09 AM (6 weeks ago)
Author:
alphanetbd
Message:

Update version to 1.0.17 and enhance OTP handling with user profile metadata storage

Location:
alpha-sms
Files:
40 added
5 edited

Legend:

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

    r3432651 r3463125  
    55Tested up to: 6.9
    66Requires PHP: 5.6
    7 Stable tag: 1.0.16
     7Stable tag: 1.0.17
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6060== Changelog ==
    6161
     62= 1.0.17 =
     63* Save verified registration phone numbers to user profile metadata for OTP login reuse.
     64* Scope registration nonce checks to form POSTs so user meta sync runs on hook calls.
     65
    6266= 1.0.13 =
    6367* Added a background processor so campaign SMS messages are queued individually and sent by scheduled jobs.
  • alpha-sms/trunk/alpha_sms.php

    r3432651 r3463125  
    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.16
     19 * Version:           1.0.17
    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.16');
     38define('ALPHA_SMS_VERSION', '1.0.17');
    3939
    4040// plugin constants
  • alpha-sms/trunk/includes/class-alpha_sms-loader.php

    r2627862 r3463125  
    11<?php
    2 
     2if ( ! defined( 'ABSPATH' ) ) exit;
    33/**
    44 * Register all actions and filters for the plugin
  • alpha-sms/trunk/includes/class-alpha_sms.php

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

    r3432662 r3463125  
    609609        }
    610610
     611        $is_post_request = isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST';
     612        $action_type     = isset($_POST['action_type']) ? sanitize_text_field(wp_unslash($_POST['action_type'])) : '';
     613
    611614        // Nonce validation for WooCommerce registration phone field: require nonce when wc_reg option enabled
    612         if (! empty($this->options['wc_reg'])) {
     615        if ($is_post_request && $action_type === 'wc_reg' && ! empty($this->options['wc_reg'])) {
    613616            $wc_reg_phone_nonce = isset($_POST['wc_reg_phone_nonce']) ? sanitize_text_field(wp_unslash($_POST['wc_reg_phone_nonce'])) : '';
    614617            if (empty($wc_reg_phone_nonce) || ! function_exists('wp_verify_nonce') || ! wp_verify_nonce($wc_reg_phone_nonce, 'wc_reg_phone_action')) {
     
    623626
    624627        // Nonce validation for WP registration phone field: require nonce when wp_reg option enabled
    625         if (! empty($this->options['wp_reg'])) {
     628        if ($is_post_request && $action_type === 'wp_reg' && ! empty($this->options['wp_reg'])) {
    626629            $wp_reg_phone_nonce = isset($_POST['wp_reg_phone_nonce']) ? sanitize_text_field(wp_unslash($_POST['wp_reg_phone_nonce'])) : '';
    627630            if (empty($wp_reg_phone_nonce) || ! function_exists('wp_verify_nonce') || ! wp_verify_nonce($wp_reg_phone_nonce, 'wp_reg_phone_action')) {
     
    641644            $billing_phone = sanitize_text_field(wp_unslash($_POST['billing_phone']));
    642645            if ($this->validateNumber($billing_phone)) {
    643                 update_user_meta(
    644                     $customer_id,
    645                     'billing_phone',
    646                     $this->validateNumber($billing_phone)
    647                 );
    648             }
    649         }
     646                $this->save_verified_phone_to_user_profile($customer_id, $billing_phone);
     647            }
     648        }
     649    }
     650
     651    /**
     652     * Save verified phone to user profile meta
     653     *
     654     * @param int    $user_id User ID
     655     * @param string $phone   Phone number
     656     */
     657    public function save_verified_phone_to_user_profile($user_id, $phone)
     658    {
     659        if (empty($user_id) || empty($phone)) {
     660            return;
     661        }
     662
     663        $validated_phone = $this->validateNumber($phone);
     664        if (!$validated_phone) {
     665            return;
     666        }
     667
     668        update_user_meta($user_id, 'billing_phone', $validated_phone);
     669        update_user_meta($user_id, 'mobile_phone', $validated_phone);
    650670    }
    651671
Note: See TracChangeset for help on using the changeset viewer.