Changeset 3183506
- Timestamp:
- 11/07/2024 04:41:43 AM (17 months ago)
- Location:
- alpha-sms
- Files:
-
- 47 added
- 5 edited
-
tags/1.0.10 (added)
-
tags/1.0.10/LICENSE.txt (added)
-
tags/1.0.10/README.txt (added)
-
tags/1.0.10/admin (added)
-
tags/1.0.10/admin/class-alpha_sms-admin.php (added)
-
tags/1.0.10/admin/css (added)
-
tags/1.0.10/admin/css/alpha_sms-admin.css (added)
-
tags/1.0.10/admin/index.php (added)
-
tags/1.0.10/admin/js (added)
-
tags/1.0.10/admin/js/alpha_sms-admin.js (added)
-
tags/1.0.10/admin/partials (added)
-
tags/1.0.10/admin/partials/alpha_sms-admin-display_campaign.php (added)
-
tags/1.0.10/admin/partials/alpha_sms-admin-display_settings.php (added)
-
tags/1.0.10/alpha_sms.php (added)
-
tags/1.0.10/assets (added)
-
tags/1.0.10/assets/banner-1544x500.png (added)
-
tags/1.0.10/assets/banner-772x250.png (added)
-
tags/1.0.10/assets/icon-128x128.png (added)
-
tags/1.0.10/assets/icon-256x256.png (added)
-
tags/1.0.10/assets/screenshot-1.jpg (added)
-
tags/1.0.10/assets/screenshot-2.jpg (added)
-
tags/1.0.10/assets/smsBanner.ai (added)
-
tags/1.0.10/includes (added)
-
tags/1.0.10/includes/class-alpha_sms-activator.php (added)
-
tags/1.0.10/includes/class-alpha_sms-deactivator.php (added)
-
tags/1.0.10/includes/class-alpha_sms-i18n.php (added)
-
tags/1.0.10/includes/class-alpha_sms-loader.php (added)
-
tags/1.0.10/includes/class-alpha_sms.php (added)
-
tags/1.0.10/includes/index.php (added)
-
tags/1.0.10/includes/sms.class.php (added)
-
tags/1.0.10/index.php (added)
-
tags/1.0.10/languages (added)
-
tags/1.0.10/languages/alpha_sms.pot (added)
-
tags/1.0.10/public (added)
-
tags/1.0.10/public/class-alpha_sms-public.php (added)
-
tags/1.0.10/public/css (added)
-
tags/1.0.10/public/css/alpha_sms-public.css (added)
-
tags/1.0.10/public/css/otp-login-form.css (added)
-
tags/1.0.10/public/index.php (added)
-
tags/1.0.10/public/js (added)
-
tags/1.0.10/public/js/alpha_sms-public.js (added)
-
tags/1.0.10/public/js/otp-login-form.js (added)
-
tags/1.0.10/public/partials (added)
-
tags/1.0.10/public/partials/add-otp-checkout-form.php (added)
-
tags/1.0.10/public/partials/add-otp-on-login-form.php (added)
-
tags/1.0.10/public/partials/add-otp-on-wc-reg-form.php (added)
-
tags/1.0.10/uninstall.php (added)
-
trunk/README.txt (modified) (1 diff)
-
trunk/alpha_sms.php (modified) (2 diffs)
-
trunk/public/class-alpha_sms-public.php (modified) (7 diffs)
-
trunk/public/js/alpha_sms-public.js (modified) (3 diffs)
-
trunk/public/partials/add-otp-checkout-form.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
alpha-sms/trunk/README.txt
r3028026 r3183506 3 3 Tags: order notification, order SMS, woocommerce sms integration, sms plugin, mobile verification, OTP, SMS notifications, two-step verification, OTP verification, SMS, signup security, user verification, user security, SMS gateway, order SMS, order notifications, WordPress OTP, 2FA, login OTP, WP SMS 4 4 Requires at least: 3.5 5 Tested up to: 6. 25 Tested up to: 6.6.2 6 6 Requires PHP: 5.6 7 Stable tag: 1.0. 97 Stable tag: 1.0.10 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
alpha-sms/trunk/alpha_sms.php
r3028026 r3183506 17 17 * Plugin URI: https://sms.net.bd/plugins/wordpress 18 18 * Description: WP 2FA Login. SMS OTP Verification for Registration and Login forms, WooCommerce SMS Notification for your shop orders. 19 * Version: 1.0. 919 * Version: 1.0.10 20 20 * Author: Alpha Net 21 21 * Author URI: https://sms.net.bd/ … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define('ALPHA_SMS_VERSION', '1.0. 9');38 define('ALPHA_SMS_VERSION', '1.0.10'); 39 39 40 40 // plugin constants -
alpha-sms/trunk/public/class-alpha_sms-public.php
r3028026 r3183506 58 58 } 59 59 60 /**60 /** 61 61 * @return void 62 62 * @since 1.0.0 … … 70 70 } 71 71 72 72 73 /** 73 74 * Register the stylesheets for the public-facing side of the site. … … 195 196 public function send_otp_for_reg() 196 197 { 197 $user_phone = $user_email ='';198 199 if (isset($_POST['billing_phone'] , $_POST['email'])) {198 $user_phone = ''; 199 200 if (isset($_POST['billing_phone'])) { 200 201 $user_phone = $this->validateNumber(sanitize_text_field($_POST['billing_phone'])); 201 $user_email = sanitize_text_field($_POST['email']);202 }203 204 if (!$user_email && !empty($_POST['billing_email'])) {205 $user_email = sanitize_text_field($_POST['billing_email']);206 }207 208 if (!filter_var($user_email, FILTER_VALIDATE_EMAIL)) {209 $response = ['status' => 400, 'message' => __('The email address you entered is not valid!')];210 echo wp_kses_post(json_encode($response));211 wp_die();212 exit;213 202 } 214 203 … … 226 215 exit; 227 216 } 217 218 // check for already send otp by checking expiration 219 $otp_expires = WC()->session->get('alpha_sms_expires'); 220 221 if (!empty($otp_expires) && strtotime($otp_expires) > strtotime(ALPHA_SMS_TIMESTAMP)) { 222 $response = [ 223 'status' => 400, 224 'message' => 'OTP already sent to a phone number. Please try again after ' . date('i:s', strtotime($otp_expires) - strtotime(ALPHA_SMS_TIMESTAMP) . ' min'), 225 ]; 226 echo wp_kses_post(json_encode($response)); 227 wp_die(); 228 exit; 229 } 230 228 231 229 232 //we will send sms … … 343 346 ) { 344 347 $dateTime = new DateTime(ALPHA_SMS_TIMESTAMP); 345 $dateTime->modify('+2 minutes'); 346 347 $_SESSION['alpha_sms_otp_code'] = $otp_code; 348 $_SESSION['alpha_sms_expires'] = $dateTime->format('Y-m-d H:i:s'); 349 350 if (!empty($_SESSION['alpha_sms_otp_code'])) { 348 $dateTime->modify('+3 minutes'); 349 350 WC()->session->set('alpha_sms_otp_phone', $mobile_phone); 351 WC()->session->set('alpha_sms_otp_code', $otp_code); 352 WC()->session->set('alpha_sms_expires', $dateTime->format('Y-m-d H:i:s')); 353 354 if(WC()->session->get('alpha_sms_otp_code')) { 351 355 return true; 352 356 } … … 512 516 public function authenticate_otp($otp_code) 513 517 { 514 515 516 if (!empty($_SESSION['alpha_sms_otp_code']) && !empty($_SESSION['alpha_sms_expires'])) { 517 518 if (strtotime($ _SESSION['alpha_sms_expires']) > strtotime(ALPHA_SMS_TIMESTAMP)) {519 if ($otp_code === $ _SESSION['alpha_sms_otp_code']) {518 $otp_code_session = WC()->session->get('alpha_sms_otp_code'); 519 $otp_expires_session = WC()->session->get('alpha_sms_expires'); 520 521 if (!empty($otp_code_session) && !empty($otp_expires_session)) { 522 if (strtotime($otp_expires_session) > strtotime(ALPHA_SMS_TIMESTAMP)) { 523 if ($otp_code === $otp_code_session) { 520 524 return true; 521 525 } … … 532 536 public function deletePastData() 533 537 { 534 if (isset($_SESSION['alpha_sms_otp_code'], $_SESSION['alpha_sms_expires'])) { 535 unset($_SESSION['alpha_sms_otp_code'], $_SESSION['alpha_sms_expires']); 538 if (WC()->session->get('alpha_sms_otp_code') || WC()->session->get('alpha_sms_expires')) { 539 WC()->session->__unset('alpha_sms_otp_code'); 540 WC()->session->__unset('alpha_sms_expires'); 536 541 } 537 542 } -
alpha-sms/trunk/public/js/alpha_sms-public.js
r2812471 r3183506 28 28 checkout_form = $('#alpha_sms_otp_checkout').parents('form.checkout.woocommerce-checkout').eq(0); 29 29 $(document).on('click', '#place_order2', WC_Checkout_SendOtp); 30 31 30 32 } 31 33 }); … … 178 180 alert_wrapper.html(''); 179 181 180 let firstName = checkout_form.find('#billing_first_name').val();181 let lastName = checkout_form.find('#billing_last_name').val();182 let country = checkout_form.find('#billing_country').val();183 let address = checkout_form.find('#billing_address_1').val();184 let city = checkout_form.find('#billing_city').val();185 let state = checkout_form.find('#billing_state').val();186 182 let phone = checkout_form.find('#billing_phone').val(); 187 let email = checkout_form.find('#billing_email').val();188 183 189 184 if ( 190 !firstName || 191 !lastName || 192 !country || 193 !address || 194 !city || 195 !state || 196 !phone || 197 !email 185 !phone 198 186 ) { 199 187 checkout_form … … 213 201 action: 'wc_send_otp', //calls wp_ajax_nopriv_wc_send_otp 214 202 billing_phone: checkout_form.find('#billing_phone').val(), 215 email: checkout_form.find('#billing_email').val(),216 203 action_type: checkout_form.find('#action_type').val() 217 204 }; -
alpha-sms/trunk/public/partials/add-otp-checkout-form.php
r2627862 r3183506 1 1 <?php 2 2 // If this file is called directly, abort. 3 if ( ! defined( 'WPINC' )) {4 die;3 if (! defined('WPINC')) { 4 die; 5 5 } 6 6 ?> … … 10 10 <label for="otp_code" class="d-inline-block">OTP Code</label> 11 11 <div id="wc_checkout_resend_otp" class="float-right"></div> 12 <input type="number" class="input " id="otp_code" name="otp_code" />12 <input type="number" class="input-text" id="otp_code" name="otp_code" /> 13 13 </div> 14 14 </div> 15 <button type="button" class=" button alt" name="woocommerce_checkout_place_order" id="place_order2">Place order</button>15 <button type="button" class="alt button wp-element-button" name="woocommerce_checkout_place_order" id="place_order2">Place order</button> 16 16 <style> 17 button#place_order {18 display: none;19 }17 button#place_order { 18 display: none; 19 } 20 20 </style> 21 <script> 22 $(document).ready(function() { 23 // Get computed styles of #place_order 24 const placeOrderStyles = window.getComputedStyle(document.getElementById('place_order')); 25 26 $.each(placeOrderStyles, function(i, propertyName) { 27 if (propertyName === 'display') return; // Skip display property if needed 28 $('#place_order2').css(propertyName, placeOrderStyles.getPropertyValue(propertyName)); 29 }); 30 }); 31 </script>
Note: See TracChangeset
for help on using the changeset viewer.