Changeset 3373498
- Timestamp:
- 10/06/2025 08:33:22 AM (5 months ago)
- Location:
- keyless-auth
- Files:
-
- 35 added
- 5 edited
-
tags/2.6.3 (added)
-
tags/2.6.3/LICENSE (added)
-
tags/2.6.3/assets (added)
-
tags/2.6.3/assets/css (added)
-
tags/2.6.3/assets/css/2fa-frontend.css (added)
-
tags/2.6.3/assets/css/admin-style.css (added)
-
tags/2.6.3/assets/css/forms-enhanced-dark.css (added)
-
tags/2.6.3/assets/css/forms-enhanced-light.css (added)
-
tags/2.6.3/assets/css/forms-enhanced.css (added)
-
tags/2.6.3/assets/css/style-back-end.css (added)
-
tags/2.6.3/assets/css/style-front-end.css (added)
-
tags/2.6.3/assets/js (added)
-
tags/2.6.3/assets/js/2fa-frontend.js (added)
-
tags/2.6.3/assets/js/admin-script.js (added)
-
tags/2.6.3/assets/js/qrcode.js (added)
-
tags/2.6.3/assets/js/qrcode.min.js (added)
-
tags/2.6.3/assets/logo_150_150.png (added)
-
tags/2.6.3/inc (added)
-
tags/2.6.3/inc/chrmrtns.class.notices.php (added)
-
tags/2.6.3/includes (added)
-
tags/2.6.3/includes/class-chrmrtns-kla-2fa-core.php (added)
-
tags/2.6.3/includes/class-chrmrtns-kla-2fa-frontend.php (added)
-
tags/2.6.3/includes/class-chrmrtns-kla-admin.php (added)
-
tags/2.6.3/includes/class-chrmrtns-kla-core.php (added)
-
tags/2.6.3/includes/class-chrmrtns-kla-database.php (added)
-
tags/2.6.3/includes/class-chrmrtns-kla-email-templates.php (added)
-
tags/2.6.3/includes/class-chrmrtns-kla-mail-logger.php (added)
-
tags/2.6.3/includes/class-chrmrtns-kla-smtp.php (added)
-
tags/2.6.3/includes/class-chrmrtns-kla-totp.php (added)
-
tags/2.6.3/keyless-auth.php (added)
-
tags/2.6.3/languages (added)
-
tags/2.6.3/languages/keyless-auth.pot (added)
-
tags/2.6.3/readme.txt (added)
-
trunk/assets/css/forms-enhanced-dark.css (added)
-
trunk/assets/css/forms-enhanced-light.css (added)
-
trunk/includes/class-chrmrtns-kla-2fa-frontend.php (modified) (3 diffs)
-
trunk/includes/class-chrmrtns-kla-admin.php (modified) (5 diffs)
-
trunk/includes/class-chrmrtns-kla-core.php (modified) (5 diffs)
-
trunk/keyless-auth.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
keyless-auth/trunk/includes/class-chrmrtns-kla-2fa-frontend.php
r3372203 r3373498 45 45 // Initialize hooks 46 46 add_shortcode('keyless-auth-2fa', array($this, 'render_2fa_shortcode')); 47 add_action('wp_enqueue_scripts', array($this, 'enqueue_frontend_scripts'));48 47 add_action('wp_ajax_chrmrtns_2fa_setup', array($this, 'handle_ajax_setup')); 49 48 add_action('wp_ajax_chrmrtns_2fa_disable', array($this, 'handle_ajax_disable')); … … 73 72 /** 74 73 * Enqueue frontend scripts and styles 74 * Called when [keyless-auth-2fa] shortcode is rendered 75 75 */ 76 76 public function enqueue_frontend_scripts() { 77 // Debug: Log script enqueue attempt 78 if (defined('WP_DEBUG') && WP_DEBUG) { 79 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- Debug logging when WP_DEBUG is enabled 80 error_log('Keyless Auth Debug: enqueue_frontend_scripts called'); 81 } 82 83 // Always enqueue scripts - let WordPress handle conditional loading 84 // This ensures scripts are available when shortcode is used 77 // Only enqueue when shortcode is actually used 78 // This ensures scripts/styles are available when needed without loading globally 85 79 86 80 // Debug: Log the URLs being used … … 127 121 CHRMRTNS_KLA_PLUGIN_URL . 'assets/css/2fa-frontend.css', 128 122 array(), 129 CHRMRTNS_KLA_VERSION . '.2' // Added .2 to force cache bust for --kla-primary-light fix123 CHRMRTNS_KLA_VERSION 130 124 ); 131 }132 133 /**134 * Check if current page contains 2FA shortcode135 *136 * @return bool137 */138 private function is_2fa_page() {139 global $post;140 return $post && has_shortcode($post->post_content, 'keyless-auth-2fa');141 125 } 142 126 -
keyless-auth/trunk/includes/class-chrmrtns-kla-admin.php
r3372303 r3373498 152 152 'sanitize_callback' => 'esc_url_raw', 153 153 'default' => '' 154 )); 155 register_setting('chrmrtns_kla_options_group', 'chrmrtns_kla_dark_mode_setting', array( 156 'sanitize_callback' => array($this, 'sanitize_dark_mode_setting'), 157 'default' => 'auto' 154 158 )); 155 159 … … 767 771 $custom_2fa_setup_url = isset($_POST['chrmrtns_kla_custom_2fa_setup_url']) ? esc_url_raw(wp_unslash($_POST['chrmrtns_kla_custom_2fa_setup_url'])) : ''; 768 772 update_option('chrmrtns_kla_custom_2fa_setup_url', $custom_2fa_setup_url); 773 774 $dark_mode_setting = isset($_POST['chrmrtns_kla_dark_mode_setting']) ? sanitize_text_field(wp_unslash($_POST['chrmrtns_kla_dark_mode_setting'])) : 'auto'; 775 update_option('chrmrtns_kla_dark_mode_setting', $this->sanitize_dark_mode_setting($dark_mode_setting)); 769 776 770 777 // Handle 2FA settings … … 889 896 </table> 890 897 898 <hr style="margin: 40px 0; border: 0; border-top: 1px solid #dcdcde;"> 899 900 <!-- Dark Mode Settings Section --> 901 <h2><?php esc_html_e('Appearance & Theme Settings', 'keyless-auth'); ?></h2> 902 <p class="description" style="margin-bottom: 20px;"> 903 <?php esc_html_e('Control how login forms appear in light and dark mode themes.', 'keyless-auth'); ?> 904 </p> 905 906 <table class="form-table"> 907 <tr> 908 <th scope="row"> 909 <label for="chrmrtns_kla_dark_mode_setting"><?php esc_html_e('Dark Mode Behavior', 'keyless-auth'); ?></label> 910 </th> 911 <td> 912 <?php $dark_mode_setting = get_option('chrmrtns_kla_dark_mode_setting', 'auto'); ?> 913 <select id="chrmrtns_kla_dark_mode_setting" name="chrmrtns_kla_dark_mode_setting"> 914 <option value="auto" <?php selected($dark_mode_setting, 'auto'); ?>><?php esc_html_e('Auto (System Preference + Theme Classes)', 'keyless-auth'); ?></option> 915 <option value="light" <?php selected($dark_mode_setting, 'light'); ?>><?php esc_html_e('Light Only (No Dark Mode)', 'keyless-auth'); ?></option> 916 <option value="dark" <?php selected($dark_mode_setting, 'dark'); ?>><?php esc_html_e('Dark Only (Force Dark Mode)', 'keyless-auth'); ?></option> 917 </select> 918 <p class="description"> 919 <?php esc_html_e('Control how login forms appear in dark mode. Auto detects system preferences and theme dark mode classes. Light Only forces light theme. Dark Only forces dark theme.', 'keyless-auth'); ?> 920 </p> 921 </td> 922 </tr> 923 </table> 924 925 <hr style="margin: 40px 0; border: 0; border-top: 1px solid #dcdcde;"> 926 891 927 <!-- 2FA Settings Section --> 892 <h2 style="margin-top: 40px;"><?php esc_html_e('Two-Factor Authentication (2FA)', 'keyless-auth'); ?></h2>928 <h2><?php esc_html_e('Two-Factor Authentication (2FA)', 'keyless-auth'); ?></h2> 893 929 <p class="description" style="margin-bottom: 20px;"> 894 930 <?php esc_html_e('Add an extra layer of security with TOTP-based two-factor authentication using authenticator apps.', 'keyless-auth'); ?> … … 1237 1273 <div class="notice notice-warning inline" style="margin: 15px 0;"> 1238 1274 <p><strong><?php esc_html_e('Security Note:', 'keyless-auth'); ?></strong> <?php esc_html_e('Application Passwords are time-limited tokens that can be revoked individually. They provide better security than using regular passwords for API access.', 'keyless-auth'); ?></p> 1275 </div> 1276 </div> 1277 1278 <div class="chrmrtns_kla_card"> 1279 <h2><?php esc_html_e('Appearance & Theme Settings', 'keyless-auth'); ?></h2> 1280 <p><?php esc_html_e('Control how login forms appear in light and dark mode themes.', 'keyless-auth'); ?></p> 1281 1282 <h3><?php esc_html_e('Dark Mode Behavior', 'keyless-auth'); ?></h3> 1283 <p><?php esc_html_e('You can control how login forms render in dark mode from the Options page. Three modes are available:', 'keyless-auth'); ?></p> 1284 1285 <ul> 1286 <li><strong><?php esc_html_e('Auto (Default):', 'keyless-auth'); ?></strong> <?php esc_html_e('Automatically detects system dark mode preference and theme dark mode classes. Forms adapt to match user\'s system settings and theme.', 'keyless-auth'); ?></li> 1287 <li><strong><?php esc_html_e('Light Only:', 'keyless-auth'); ?></strong> <?php esc_html_e('Forces light theme always, disables dark mode completely. Use this if you want consistent light appearance regardless of user preferences.', 'keyless-auth'); ?></li> 1288 <li><strong><?php esc_html_e('Dark Only:', 'keyless-auth'); ?></strong> <?php esc_html_e('Forces dark theme always. Use this if your site has a dark theme and you want forms to always match.', 'keyless-auth'); ?></li> 1289 </ul> 1290 1291 <p><strong><?php esc_html_e('Where to configure:', 'keyless-auth'); ?></strong> <?php esc_html_e('Go to Options → Appearance & Theme Settings → Dark Mode Behavior', 'keyless-auth'); ?></p> 1292 1293 <div class="notice notice-info inline" style="margin: 15px 0;"> 1294 <p><strong><?php esc_html_e('Performance Note:', 'keyless-auth'); ?></strong> <?php esc_html_e('CSS files only load when shortcodes are used on a page, saving bandwidth on pages without login forms.', 'keyless-auth'); ?></p> 1239 1295 </div> 1240 1296 </div> … … 1561 1617 return ($input === '1' || $input === 1 || $input === true) ? '1' : '0'; 1562 1618 } 1619 1620 /** 1621 * Sanitize dark mode setting 1622 */ 1623 public function sanitize_dark_mode_setting($input) { 1624 $valid_options = array('auto', 'light', 'dark'); 1625 return in_array($input, $valid_options, true) ? $input : 'auto'; 1626 } 1563 1627 } -
keyless-auth/trunk/includes/class-chrmrtns-kla-core.php
r3372303 r3373498 23 23 add_shortcode('keyless-auth', array($this, 'render_login_form')); 24 24 add_shortcode('keyless-auth-full', array($this, 'render_full_login_form')); 25 add_action('wp_enqueue_scripts', array($this, 'enqueue_frontend_scripts'));26 25 27 26 // wp-login.php integration - only add hooks if enabled … … 29 28 add_action('login_footer', array($this, 'chrmrtns_kla_add_wp_login_field')); 30 29 add_action('login_init', array($this, 'chrmrtns_kla_handle_wp_login_submission')); 30 add_action('login_enqueue_scripts', array($this, 'enqueue_frontend_scripts')); 31 31 } 32 32 … … 58 58 */ 59 59 public function render_login_form($atts = array()) { 60 // Enqueue styles when shortcode is rendered 61 $this->enqueue_frontend_scripts(); 62 60 63 // Parse attributes with defaults 61 64 $atts = shortcode_atts(array( … … 155 158 */ 156 159 public function render_full_login_form($atts = array()) { 160 // Enqueue styles when shortcode is rendered 161 $this->enqueue_frontend_scripts(); 162 157 163 // Parse attributes with defaults 158 164 $atts = shortcode_atts(array( … … 741 747 // Enqueue legacy styles for backward compatibility 742 748 if (file_exists(CHRMRTNS_KLA_PLUGIN_DIR . '/assets/css/style-front-end.css')) { 743 wp_register_style('chrmrtns_frontend_stylesheet', CHRMRTNS_KLA_PLUGIN_URL . 'assets/css/style-front-end.css', array(), CHRMRTNS_KLA_VERSION . '.1');749 wp_register_style('chrmrtns_frontend_stylesheet', CHRMRTNS_KLA_PLUGIN_URL . 'assets/css/style-front-end.css', array(), CHRMRTNS_KLA_VERSION); 744 750 wp_enqueue_style('chrmrtns_frontend_stylesheet'); 745 751 } 746 752 747 // Enqueue enhanced forms stylesheet with higher priority 748 if (file_exists(CHRMRTNS_KLA_PLUGIN_DIR . '/assets/css/forms-enhanced.css')) { 753 // Get dark mode setting 754 $dark_mode_setting = get_option('chrmrtns_kla_dark_mode_setting', 'auto'); 755 756 // Determine which CSS file to load based on dark mode setting 757 $css_file = 'forms-enhanced.css'; // Default: auto mode 758 759 switch ($dark_mode_setting) { 760 case 'light': 761 $css_file = 'forms-enhanced-light.css'; 762 break; 763 case 'dark': 764 $css_file = 'forms-enhanced-dark.css'; 765 break; 766 case 'auto': 767 default: 768 $css_file = 'forms-enhanced.css'; 769 break; 770 } 771 772 // Enqueue the appropriate enhanced forms stylesheet 773 if (file_exists(CHRMRTNS_KLA_PLUGIN_DIR . '/assets/css/' . $css_file)) { 749 774 wp_enqueue_style( 750 775 'chrmrtns_kla_forms_enhanced', 751 CHRMRTNS_KLA_PLUGIN_URL . 'assets/css/ forms-enhanced.css',776 CHRMRTNS_KLA_PLUGIN_URL . 'assets/css/' . $css_file, 752 777 array('chrmrtns_frontend_stylesheet'), // Load after the base stylesheet 753 CHRMRTNS_KLA_VERSION . '.1', // Added .1 to force cache bust for message box colors and dark mode778 CHRMRTNS_KLA_VERSION, 754 779 'all' 755 780 ); -
keyless-auth/trunk/keyless-auth.php
r3372303 r3373498 4 4 * Plugin URI: https://github.com/chrmrtns/keyless-auth 5 5 * Description: Enhanced passwordless authentication allowing users to login securely without passwords via email magic links. Fork of Passwordless Login by Cozmoslabs with additional security features. 6 * Version: 2.6. 26 * Version: 2.6.3 7 7 * Author: Chris Martens 8 8 * Author URI: https://github.com/chrmrtns … … 38 38 39 39 // Define plugin constants 40 define('CHRMRTNS_KLA_VERSION', '2.6. 2');40 define('CHRMRTNS_KLA_VERSION', '2.6.3'); 41 41 define('CHRMRTNS_KLA_PLUGIN_DIR', plugin_dir_path(__FILE__)); 42 42 define('CHRMRTNS_KLA_PLUGIN_URL', plugin_dir_url(__FILE__)); -
keyless-auth/trunk/readme.txt
r3372303 r3373498 6 6 Requires at least: 3.9 7 7 Tested up to: 6.8 8 Stable tag: 2.6. 28 Stable tag: 2.6.3 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 271 271 272 272 == Changelog == 273 = 2.6.3 = 274 * PERFORMANCE: CSS files now load conditionally only when shortcodes are used (saves ~15KB on pages without login forms) 275 * PERFORMANCE: 2FA CSS and JS now load conditionally only when [keyless-auth-2fa] shortcode is used (saves additional ~38KB) 276 * PERFORMANCE: CSS no longer loads on every page globally, only when [keyless-auth], [keyless-auth-full], or [keyless-auth-2fa] shortcodes are rendered 277 * PERFORMANCE: wp-login.php integration still loads CSS automatically when enabled 278 * NEW: Dark Mode Behavior setting in Options page - control how forms appear in dark mode 279 * NEW: Three dark mode options: Auto (default, respects system + theme), Light Only (force light), Dark Only (force dark) 280 * NEW: Separate CSS files for light-only and dark-only modes (forms-enhanced-light.css, forms-enhanced-dark.css) 281 * ENHANCEMENT: Better performance for sites with many pages without login forms (total savings: ~53KB per page) 282 * ENHANCEMENT: Admin can now force light or dark theme regardless of user system preferences 283 * COMPATIBILITY: Dark mode setting works with all major WordPress themes and block themes 284 273 285 = 2.6.2 = 274 286 * FIX: Replaced hardcoded colors in style-front-end.css with CSS variables for proper dark mode support
Note: See TracChangeset
for help on using the changeset viewer.