Changeset 3430528
- Timestamp:
- 01/01/2026 01:16:55 PM (3 months ago)
- Location:
- otppal/trunk
- Files:
-
- 1 added
- 3 edited
-
admin/class-otppal-admin.php (modified) (3 diffs)
-
assets/js/admin-message-template.js (added)
-
otppal.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
otppal/trunk/admin/class-otppal-admin.php
r3423725 r3430528 46 46 'dashicons-format-chat', 47 47 30 48 ); 49 50 // Add OTP Message Template submenu 51 add_submenu_page( 52 'otppal-settings', 53 __('OTP Message Template', 'otppal'), 54 __('OTP Message Template', 'otppal'), 55 'manage_options', 56 'otppal-message-template', 57 array($this, 'render_message_template_page') 48 58 ); 49 59 } … … 552 562 'nonce' => wp_create_nonce('otppal_dismiss_warning') 553 563 )); 564 565 // Enqueue scripts for message template page 566 if ('otppal-settings_page_otppal-message-template' === $hook) { 567 wp_enqueue_script( 568 'otppal-message-template', 569 OTPPAL_URL . 'assets/js/admin-message-template.js', 570 array('jquery'), 571 OTPPAL_VERSION, 572 true 573 ); 574 575 $api_key = get_option('otppal_api_key', ''); 576 $server_url = defined('OTPPAL_SERVER_URL') ? OTPPAL_SERVER_URL : 'https://otppal.com'; 577 578 wp_localize_script('otppal-message-template', 'otppalMessageTemplate', array( 579 'apiKey' => $api_key, 580 'serverUrl' => rtrim($server_url, '/'), 581 'restUrl' => rtrim($server_url, '/') . '/wp-json/otppal-server/v1/otp/template', 582 'nonce' => wp_create_nonce('otppal_message_template'), 583 )); 584 } 554 585 555 586 // Only enqueue styles and settings-specific scripts on settings page … … 2851 2882 wp_send_json_success(); 2852 2883 } 2884 2885 /** 2886 * Render OTP Message Template page 2887 */ 2888 public function render_message_template_page() 2889 { 2890 $api_key = get_option('otppal_api_key', ''); 2891 if (empty($api_key)) { 2892 ?> 2893 <div class="wrap"> 2894 <h1><?php esc_html_e('OTP Message Template', 'otppal'); ?></h1> 2895 <div class="notice notice-error"> 2896 <p><?php esc_html_e('Please configure your OtpPal API key in the main settings page first.', 'otppal'); ?></p> 2897 </div> 2898 </div> 2899 <?php 2900 return; 2901 } 2902 ?> 2903 <div class="wrap"> 2904 <h1><?php esc_html_e('OTP Message Template', 'otppal'); ?></h1> 2905 <p class="description"><?php esc_html_e('Customize the OTP message that will be sent to your users. If left unchecked, the global template will be used.', 'otppal'); ?></p> 2906 2907 <div id="otppal-template-loading" style="text-align: center; padding: 40px;"> 2908 <div class="otppal-spinner-container"> 2909 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 127.27 128.68" style="width: 64px; height: 64px; margin: 0 auto; animation: otppal-spin 1s linear infinite; transform-origin: center;"> 2910 <defs><style>.cls-1 { fill: #e7ff00; }</style></defs> 2911 <g><path class="cls-1" d="M126.29,73.05l-21.87-12.63c-1.59-.92-1.17-3.32.64-3.64l16.42-2.9c1.07-.19,1.78-1.21,1.59-2.28l-3.41-19.36c-.19-1.07-1.21-1.78-2.28-1.59l-45.11,7.95c-1.39.24-2.57-1.01-2.26-2.38l6.77-29.41c.24-1.06-.42-2.11-1.47-2.36L56.16.05c-1.06-.24-2.11.42-2.36,1.47l-8.31,36.09c-.36,1.58-2.38,2.07-3.42.82l-16.25-19.37c-.7-.83-1.94-.94-2.77-.24l-15.06,12.63c-.83.7-.94,1.94-.24,2.77l16.24,19.35c1.18,1.41-.04,3.52-1.85,3.2l-16.42-2.9c-1.07-.19-2.09.53-2.28,1.59L.03,74.83c-.19,1.07.53,2.09,1.59,2.28l51.47,9.08c1.2.21,1.92,1.46,1.51,2.61l-11.11,30.52c-.37,1.02.15,2.15,1.17,2.52l18.47,6.72c1.02.37,2.15-.15,2.52-1.17l8.64-23.74c.63-1.72,3.07-1.72,3.69,0l5.7,15.67c.37,1.02,1.5,1.55,2.52,1.17l18.47-6.72c1.02-.37,1.55-1.5,1.17-2.52l-8.64-23.74c-.63-1.72,1.24-3.29,2.83-2.37l16.42,2.9c1.07.19,2.09-.53,2.28-1.59l3.41-19.36c.19-1.07-.53-2.09-1.59-2.28l-45.11-7.95c-1.39-.24-2.57,1.01-2.26,2.38l6.77,29.41c.24,1.06-.42,2.11-1.47,2.36l-19.36,4.39c-1.06.24-2.11-.42-2.36-1.47l-8.31-36.09c-.36-1.58-2.38-2.07-3.42-.82l-16.25,19.37c-.7.83-1.94.94-2.77.24L.03,54.83c-.83-.7-.94-1.94-.24-2.77l16.24-19.35c1.18-1.41-.04-3.52-1.85-3.2l-16.42,2.9c-1.07.19-2.09-.53-2.28-1.59L.03,3.83c-.19-1.07.53-2.09,1.59-2.28l51.47-9.08c1.2-.21,1.92-1.46,1.51-2.61L42.4-38.08c-.37-1.02.15-2.15,1.17-2.52l18.47-6.72c1.02-.37,2.15.15,2.52,1.17l8.64,23.74c.63,1.72,3.07,1.72,3.69,0l5.7-15.67c.37-1.02,1.5-1.55,2.52-1.17l18.47,6.72c1.02.37,1.55,1.5,1.17,2.52l-8.64,23.74c-.63,1.72,1.24,3.29,2.83,2.37l16.42-2.9c1.07-.19,2.09.53,2.28,1.59l3.41,19.36c.19,1.07-.53,2.09-1.59,2.28l-45.11,7.95c-1.39.24-2.57-1.01-2.26-2.38l-6.77-29.41c-.24-1.06.42-2.11,1.47-2.36l19.36-4.39c1.06-.24,2.11.42,2.36,1.47l8.31,36.09c.36,1.58,2.38,2.07,3.42.82l16.25-19.37c.7-.83,1.94-.94,2.77-.24l15.06,12.63c.83.7.94,1.94.24,2.77l-16.24,19.35c-1.18,1.41.04,3.52,1.85,3.2l16.42-2.9c1.07-.19,2.09.53,2.28,1.59l3.41,19.36c.19,1.07-.53,2.09-1.59,2.28z"/></g> 2912 </svg> 2913 </div> 2914 <p><?php esc_html_e('Loading template...', 'otppal'); ?></p> 2915 </div> 2916 2917 <div id="otppal-template-form" style="display: none;"> 2918 <div id="otppal-template-message" style="margin: 15px 0;"></div> 2919 2920 <form id="otppal-message-template-form"> 2921 <table class="form-table"> 2922 <tr> 2923 <th scope="row"><?php esc_html_e('Use Custom Template', 'otppal'); ?></th> 2924 <td> 2925 <label> 2926 <input type="checkbox" name="enabled" id="otppal-template-enabled" value="1"> 2927 <?php esc_html_e('Enable custom OTP message template', 'otppal'); ?> 2928 </label> 2929 <p class="description"><?php esc_html_e('When checked, your custom template will be used. When unchecked, the global template (or default) will be used.', 'otppal'); ?></p> 2930 </td> 2931 </tr> 2932 <tr> 2933 <th scope="row"> 2934 <label for="otppal-template-text"><?php esc_html_e('Message Template', 'otppal'); ?></label> 2935 </th> 2936 <td> 2937 <textarea name="template" id="otppal-template-text" rows="4" class="large-text" maxlength="150" disabled></textarea> 2938 <p class="description"> 2939 <strong><?php esc_html_e('Available placeholders:', 'otppal'); ?></strong><br> 2940 • <code>{otp}</code> - <?php esc_html_e('The 6-digit OTP code (required)', 'otppal'); ?><br> 2941 • <code>{exp}</code> - <?php esc_html_e('Expiry time in minutes (required)', 'otppal'); ?><br> 2942 <br> 2943 <strong><?php esc_html_e('Requirements:', 'otppal'); ?></strong> <?php esc_html_e('Template must be 150 characters or less and must include both', 'otppal'); ?> <code>{otp}</code> <?php esc_html_e('and', 'otppal'); ?> <code>{exp}</code> <?php esc_html_e('placeholders exactly once.', 'otppal'); ?><br> 2944 <br> 2945 <span id="otppal-template-info"></span> 2946 </p> 2947 </td> 2948 </tr> 2949 </table> 2950 <p class="submit"> 2951 <button type="submit" class="button button-primary" id="otppal-template-submit"><?php esc_html_e('Save Template', 'otppal'); ?></button> 2952 </p> 2953 </form> 2954 </div> 2955 2956 <style> 2957 @keyframes otppal-spin { 2958 from { transform: rotateZ(0deg); } 2959 to { transform: rotateZ(360deg); } 2960 } 2961 #otppal-template-message .notice { 2962 margin: 15px 0; 2963 } 2964 </style> 2965 </div> 2966 <?php 2967 } 2853 2968 } 2854 2969 } // End if (!class_exists('OtpPal_Admin')) -
otppal/trunk/otppal.php
r3430456 r3430528 3 3 * Plugin Name: OtpPal 4 4 * Description: Client-side plugin for OtpPal Server - Send and verify OTP messages via WhatsApp 5 * Version: 5 * Version: 2.4.2 6 6 * Author: BRND Studio 7 7 * License: GPL2 -
otppal/trunk/readme.txt
r3430456 r3430528 6 6 Tested up to: 6.9 7 7 Requires PHP: 7.4 8 Stable tag: 2.4. 08 Stable tag: 2.4.2 9 9 License: GPL2 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 105 105 106 106 == Changelog == 107 = 2.4.2 = 108 * Enable Otp message customization 109 107 110 = 2.4.1 = 108 111 * Improve user lookup to allow login in sites that don't have WooCommerce … … 173 176 174 177 == Upgrade Notice == 178 = 2.4.2 = 179 Enable Otp message customization 180 175 181 = 2.4.1 = 176 182 OTP Login/Signup support for sites that don't have WooCommerce
Note: See TracChangeset
for help on using the changeset viewer.