Changeset 3496225
- Timestamp:
- 04/01/2026 06:56:06 AM (3 days ago)
- Location:
- authyo-otp-for-wpforms/trunk
- Files:
-
- 4 edited
-
assets/js/frontend.js (modified) (4 diffs)
-
assets/js/smart-field.js (modified) (3 diffs)
-
authyo-otp-for-wpforms.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
authyo-otp-for-wpforms/trunk/assets/js/frontend.js
r3458936 r3496225 138 138 } 139 139 140 function getTargetValue(wrapOrObj ) {140 function getTargetValue(wrapOrObj, stripZero = true) { 141 141 let wrap, container; 142 142 if (wrapOrObj && wrapOrObj.wrap) { … … 156 156 const countrySelect = container.querySelector('.authyo-country-code'); 157 157 if (countrySelect) { 158 const dialCode = (countrySelect.options[countrySelect.selectedIndex].dataset.dialCode || '') .replace(/\D/g, '');158 const dialCode = (countrySelect.options[countrySelect.selectedIndex].dataset.dialCode || ''); 159 159 let cleanPhone = val.replace(/\D/g, ''); 160 160 161 // If phone already starts with dial code, don't double-prefix162 if ( dialCode && cleanPhone.startsWith(dialCode)) {163 val = cleanPhone;161 // Ensure leading zero is stripped for delivery if requested 162 if (val.startsWith('+')) { 163 val = '+' + cleanPhone; 164 164 } else { 165 val = dialCode + cleanPhone; 165 const cleanVal = stripZero ? val.replace(/\D/g, '').replace(/^0+/, '') : val.replace(/\D/g, ''); 166 const displayDialCode = dialCode.startsWith('+') ? dialCode : '+' + dialCode; 167 val = displayDialCode + cleanVal; 166 168 } 167 169 } … … 835 837 if (verifiedInput) verifiedInput.value = '1'; 836 838 837 const targetInput = getTargetInput({ wrap: wrap, container: container }); 838 const verifiedValue = targetInput ? targetInput.value.trim() : ''; 839 const verifiedValue = getTargetValue({ wrap: wrap, container: container }, false); 839 840 840 841 hide($('.authyo-otp-input-row', wrap)); … … 949 950 checkedFieldIds.add(fieldId); 950 951 951 // Handle phone number prefixing before validation 952 // Handle phone number prefixing before validation (fallback for unverified fields) 952 953 if (fieldContainer.classList.contains('wpforms-field-authyo-phone')) { 953 954 const countryCode = fieldContainer.querySelector('.authyo-country-code'); 954 955 const phoneInput = fieldContainer.querySelector('.wpforms-field-authyo-phone-input'); 955 const isVerified = fieldContainer.querySelector('.authyo-verified')?.value === '1'; 956 957 if (countryCode && phoneInput && !isVerified) { 956 const isVerified = (fieldContainer.querySelector('.authyo-verified')?.value === '1') || fieldContainer.classList.contains('authyo-verified'); 957 958 // If already verified or manual input starts with +, skip this auto-prefixing 959 if (countryCode && phoneInput && !isVerified && !phoneInput.value.startsWith('+')) { 958 960 const dial = countryCode.options[countryCode.selectedIndex].dataset.dialCode || ''; 959 961 const cleanDial = dial.replace(/\D/g, ''); -
authyo-otp-for-wpforms/trunk/assets/js/smart-field.js
r3495366 r3496225 406 406 // LOW BALANCE BYPASS LOGIC 407 407 if (resp.bypass === true) { 408 if (input) { 409 input.value = target; 410 } 408 411 showVerifiedState(wrap, channel, target); // Pass target as verified value 409 412 return; … … 516 519 const dialCode = dialOptions ? dialOptions.dataset.dialCode : ''; 517 520 if (verifiedValue && !verifiedValue.startsWith('+') && dialCode) { 518 verifiedValue = dialCode + verifiedValue.replace(/^0+/, ''); 521 const displayDialCode = dialCode.startsWith('+') ? dialCode : '+' + dialCode; 522 verifiedValue = displayDialCode + verifiedValue; 519 523 } 520 524 } … … 541 545 const verifiedInput = $('.authyo-verified', wrap); 542 546 if (verifiedInput) verifiedInput.value = '1'; 547 548 const input = $('.wpforms-field-authyo-smart-input', wrap); 549 if (input) { 550 input.value = verifiedValue; 551 } 543 552 544 553 let verifiedUI = $('.authyo-verified-state', wrap); -
authyo-otp-for-wpforms/trunk/authyo-otp-for-wpforms.php
r3495366 r3496225 4 4 * Plugin URI: https://wordpress.org/plugins/authyo-otp-for-wpforms/ 5 5 * Description: Adds email and phone number OTP verification to WPForms with support for SMS, WhatsApp, and Voice. 6 * Version: 1.0. 96 * Version: 1.0.10 7 7 * Author: Authyo 8 8 * Author URI: https://authyo.io/ … … 17 17 exit; 18 18 19 define('AUTHYO_WPFORMS_VERSION', '1.0. 9');19 define('AUTHYO_WPFORMS_VERSION', '1.0.10'); 20 20 define('AUTHYO_WPFORMS_FILE', __FILE__); 21 21 define('AUTHYO_WPFORMS_PATH', plugin_dir_path(__FILE__)); -
authyo-otp-for-wpforms/trunk/readme.txt
r3495366 r3496225 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 97 Stable tag: 1.0.10 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 68 68 == Changelog == 69 69 70 = 1.0.10 = 71 * Improved: Finalized international phone formatting consistency. 72 * Fixed: Double-prefixing bug in Authyo Phone field. 73 * Added: Preserved leading zero and + prefix in all form entries. 74 * Improved: Performance improvement. 75 70 76 = 1.0.9 = 71 77 * Improved: Performance improvement
Note: See TracChangeset
for help on using the changeset viewer.