Plugin Directory

Changeset 3384409


Ignore:
Timestamp:
10/25/2025 10:41:53 AM (5 months ago)
Author:
bitsstech
Message:

version 1.0.3.5

Location:
otpfy-your-website
Files:
100 added
4 edited

Legend:

Unmodified
Added
Removed
  • otpfy-your-website/trunk/otpfy-for-wordpress.php

    r3340401 r3384409  
    1212 * Plugin URI:        https://otpfy.in
    1313 * Description:       OTPfy almost anything in your wordpress website!! OTP based Login, Signup, Order Confirmation, just anything you can imagine. Integrate OTP based 2 factor authentication using our developer hooks.
    14  * Version:           1.0.3.3
     14 * Version:           1.0.3.5
    1515 * Author:            Bitss Techniques
    1616 * Author URI:        https://bitss.tech
     
    3131 * Rename this for your plugin and update it as you release new versions.
    3232 */
    33 define( 'OTPFY_FOR_WORDPRESS_VERSION', '1.0.3.3' );
     33define( 'OTPFY_FOR_WORDPRESS_VERSION', '1.0.3.5' );
    3434
    3535/**
  • otpfy-your-website/trunk/public/class-otpfy-for-wordpress-public.php

    r3340401 r3384409  
    466466        $get_checkout_verify = $this->settings->get_checkout_verify();
    467467        if($get_checkout_verify == "off") return;
     468        $otpfy_otp_verification_needed = true;
    468469        if($get_checkout_verify == "cod" && (!isset($_POST['payment_method']) || !isset($_POST['payment_method_cod']))){
    469             return; // Skip OTP for non-COD payments
    470         }
     470            $otpfy_otp_verification_needed = false; // Skip OTP for non-COD payments
     471        }
     472        $otpfy_otp_verification_needed = apply_filters( 'otpfy_is_otp_verification_needed', $otpfy_otp_verification_needed );
     473
     474        if(!$otpfy_otp_verification_needed) return;
     475
    471476        if (is_user_logged_in()) {
    472477            $is_verified = get_user_meta(get_current_user_id(), '_otp_verified', true);
  • otpfy-your-website/trunk/public/js/otpfy-checkout.js

    r3340368 r3384409  
    6969            return true; // Skip OTP for non-COD payments
    7070        }
     71        if(otpfy_checkout_params.checkout_verify_countries && otpfy_checkout_params.checkout_verify_countries.length>0){
     72            let selectedCountry = getSelectedCountry();
     73            if(!otpfy_checkout_params.checkout_verify_countries.includes(selectedCountry)){
     74                return true; // Skip OTP for as otp is not enabled for this country.
     75            }
     76        }
     77       
     78
    7179        sendOTP();
    7280        e.preventDefault(); // Prevent form submission
     
    7482        return false; // Always block until verified!
    7583    });
     84
     85    function getSelectedCountry() {
     86        let country = '';
     87
     88        // Check if shipping country field exists and has a value
     89        const shippingCountryField = document.querySelector('#shipping_country');
     90        if (shippingCountryField && shippingCountryField.value) {
     91            country = shippingCountryField.value;
     92        }
     93
     94        // If no shipping country, check billing country
     95        if (!country) {
     96            const billingCountryField = document.querySelector('#billing_country');
     97            if (billingCountryField && billingCountryField.value) {
     98                country = billingCountryField.value;
     99            }
     100        }
     101
     102        return country;
     103    }
    76104
    77105    function sendOTP(){
     
    100128                if (resp.success) {
    101129                     $('#otp-msg').css('color', 'green').text('');
    102                     $('#otp-instructions').text('We’ve sent an OTP to your mobile. Enter it below to continue.');
     130                    $('#otp-instructions').text('We’ve sent an OTP to '+mobile+'. Enter it below to continue.');
    103131                    startResendTimer(30);
    104132                } else {
  • otpfy-your-website/trunk/public/partials/otpfy-checkout-mobile-verify-form.php

    r3340312 r3384409  
    11<?php
     2    $country_codes = [];
     3    if ( function_exists( 'WC' ) && ! empty( WC()->countries ) ) {
     4        $countries = WC()->countries->get_allowed_countries();
     5        $country_codes = array_keys( $countries );
     6    }
    27    wp_enqueue_style("otpfy-snapotp");
    38    wp_enqueue_script("otpfy-snapotp");
     
    712        'otpfy_checkout_send_otp_nonce'    => wp_create_nonce('wp_ajax_otpfy_checkout_send_otp'),
    813        'otpfy_checkout_verify_otp_nonce'    => wp_create_nonce('wp_ajax_otpfy_checkout_verify_otp'),
    9         'checkout_verify' => $get_checkout_verify
     14        'checkout_verify' => $get_checkout_verify,
     15        'checkout_verify_countries' => apply_filters( 'otpfy_checkout_verify_countries', $country_codes )
    1016    ]);
    1117
     
    1420<div class="otpfy-otp-form-modal-overlay"  id="otp-modal-overlay"  style="display:none;">
    1521  <div class="otpfy-otp-form-modal" id="otp-modal">
    16     <div class="otpfy-otp-form-desc">Enter the One-Time Password sent to your mobile.</div>
     22    <div id="otp-instructions" class="otpfy-otp-form-desc">Enter the One-Time Password sent to your mobile.</div>
    1723    <div id="otp-loader" class="otpfy-otp-form-loader"  >
    18         <div>Sending OTP…</div>
     24        <div></div>
    1925    </div>
    2026    <div id="otp_target"></div>
Note: See TracChangeset for help on using the changeset viewer.