Changeset 3378867
- Timestamp:
- 10/15/2025 11:59:42 AM (5 months ago)
- Location:
- keyless-auth
- Files:
-
- 33 added
- 4 edited
-
tags/2.7.3 (added)
-
tags/2.7.3/LICENSE (added)
-
tags/2.7.3/assets (added)
-
tags/2.7.3/assets/css (added)
-
tags/2.7.3/assets/css/2fa-frontend.css (added)
-
tags/2.7.3/assets/css/admin-style.css (added)
-
tags/2.7.3/assets/css/forms-enhanced-dark.css (added)
-
tags/2.7.3/assets/css/forms-enhanced-light.css (added)
-
tags/2.7.3/assets/css/forms-enhanced.css (added)
-
tags/2.7.3/assets/css/style-back-end.css (added)
-
tags/2.7.3/assets/css/style-front-end.css (added)
-
tags/2.7.3/assets/js (added)
-
tags/2.7.3/assets/js/2fa-frontend.js (added)
-
tags/2.7.3/assets/js/admin-script.js (added)
-
tags/2.7.3/assets/js/qrcode.js (added)
-
tags/2.7.3/assets/js/qrcode.min.js (added)
-
tags/2.7.3/assets/logo_150_150.png (added)
-
tags/2.7.3/inc (added)
-
tags/2.7.3/inc/chrmrtns.class.notices.php (added)
-
tags/2.7.3/includes (added)
-
tags/2.7.3/includes/class-chrmrtns-kla-2fa-core.php (added)
-
tags/2.7.3/includes/class-chrmrtns-kla-2fa-frontend.php (added)
-
tags/2.7.3/includes/class-chrmrtns-kla-admin.php (added)
-
tags/2.7.3/includes/class-chrmrtns-kla-core.php (added)
-
tags/2.7.3/includes/class-chrmrtns-kla-database.php (added)
-
tags/2.7.3/includes/class-chrmrtns-kla-email-templates.php (added)
-
tags/2.7.3/includes/class-chrmrtns-kla-mail-logger.php (added)
-
tags/2.7.3/includes/class-chrmrtns-kla-smtp.php (added)
-
tags/2.7.3/includes/class-chrmrtns-kla-totp.php (added)
-
tags/2.7.3/keyless-auth.php (added)
-
tags/2.7.3/languages (added)
-
tags/2.7.3/languages/keyless-auth.pot (added)
-
tags/2.7.3/readme.txt (added)
-
trunk/includes/class-chrmrtns-kla-2fa-core.php (modified) (1 diff)
-
trunk/includes/class-chrmrtns-kla-database.php (modified) (12 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-core.php
r3372203 r3378867 725 725 if (time() > $grace_end) { 726 726 wp_logout(); 727 wp_redirect( wp_login_url('?chrmrtns_kla_2fa_required=1'));727 wp_redirect(add_query_arg('chrmrtns_kla_2fa_required', '1', wp_login_url())); 728 728 exit; 729 729 } -
keyless-auth/trunk/includes/class-chrmrtns-kla-database.php
r3378019 r3378867 298 298 299 299 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $where_clause and $order_by are properly sanitized above 300 $sql = "SELECT * FROM {$wpdb->prefix} kla_login_logs300 $sql = "SELECT * FROM {$wpdb->prefix}chrmrtns_kla_login_logs 301 301 WHERE $where_clause 302 302 ORDER BY $order_by … … 397 397 398 398 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- $sql is hardcoded with proper placeholders, no dynamic content 399 $sql = "SELECT * FROM {$wpdb->prefix} kla_login_tokens399 $sql = "SELECT * FROM {$wpdb->prefix}chrmrtns_kla_login_tokens 400 400 WHERE user_id = %d 401 401 AND token_hash = %s … … 425 425 // Increment attempt count for failed attempts 426 426 $wpdb->query($wpdb->prepare( 427 "UPDATE {$wpdb->prefix} kla_login_tokens427 "UPDATE {$wpdb->prefix}chrmrtns_kla_login_tokens 428 428 SET attempt_count = attempt_count + 1 429 429 WHERE user_id = %d AND token_hash = %s", … … 449 449 450 450 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $where_clause is safely constructed above 451 $sql = "DELETE FROM {$wpdb->prefix} kla_login_tokens WHERE $where_clause"; // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared451 $sql = "DELETE FROM {$wpdb->prefix}chrmrtns_kla_login_tokens WHERE $where_clause"; // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 452 452 453 453 if (!empty($where_values)) { … … 468 468 // Total logins 469 469 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- Statistics query for custom table 470 $stats['total_logins'] = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix} kla_login_logs WHERE status = 'success'");470 $stats['total_logins'] = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}chrmrtns_kla_login_logs WHERE status = 'success'"); 471 471 472 472 // Logins this month 473 473 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- Statistics query for custom table 474 474 $stats['logins_this_month'] = $wpdb->get_var( 475 "SELECT COUNT(*) FROM {$wpdb->prefix} kla_login_logs475 "SELECT COUNT(*) FROM {$wpdb->prefix}chrmrtns_kla_login_logs 476 476 WHERE status = 'success' 477 477 AND login_time >= DATE_FORMAT(NOW(), '%Y-%m-01')" … … 480 480 // Failed attempts 481 481 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- Statistics query for custom table 482 $stats['failed_attempts'] = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix} kla_login_logs WHERE status = 'failed'");482 $stats['failed_attempts'] = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}chrmrtns_kla_login_logs WHERE status = 'failed'"); 483 483 484 484 // Total emails sent 485 485 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- Statistics query for custom table 486 $stats['emails_sent'] = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix} kla_mail_logs WHERE status = 'sent'");486 $stats['emails_sent'] = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}chrmrtns_kla_mail_logs WHERE status = 'sent'"); 487 487 488 488 // Active tokens 489 489 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- Statistics query for custom table 490 $stats['active_tokens'] = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix} kla_login_tokens WHERE expires_at > NOW() AND is_used = 0");490 $stats['active_tokens'] = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}chrmrtns_kla_login_tokens WHERE expires_at > NOW() AND is_used = 0"); 491 491 492 492 return $stats; … … 504 504 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- Maintenance cleanup of old logs 505 505 $login_deleted = $wpdb->query($wpdb->prepare( 506 "DELETE FROM {$wpdb->prefix} kla_login_logs WHERE login_time < %s",506 "DELETE FROM {$wpdb->prefix}chrmrtns_kla_login_logs WHERE login_time < %s", 507 507 $date_threshold 508 508 )); … … 511 511 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- Maintenance cleanup of old logs 512 512 $mail_deleted = $wpdb->query($wpdb->prepare( 513 "DELETE FROM {$wpdb->prefix} kla_mail_logs WHERE sent_time < %s",513 "DELETE FROM {$wpdb->prefix}chrmrtns_kla_mail_logs WHERE sent_time < %s", 514 514 $date_threshold 515 515 )); … … 585 585 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- Querying custom devices table 586 586 $existing = $wpdb->get_row($wpdb->prepare( 587 "SELECT id FROM {$wpdb->prefix} kla_user_devices WHERE user_id = %d AND device_fingerprint = %s",587 "SELECT id FROM {$wpdb->prefix}chrmrtns_kla_user_devices WHERE user_id = %d AND device_fingerprint = %s", 588 588 $user_id, $device_fingerprint 589 589 )); … … 659 659 $result = $wpdb->get_row($wpdb->prepare( 660 660 "SELECT totp_secret, totp_enabled, totp_backup_codes, totp_last_used, totp_failed_attempts, totp_locked_until 661 FROM {$wpdb->prefix} kla_user_devices661 FROM {$wpdb->prefix}chrmrtns_kla_user_devices 662 662 WHERE user_id = %d AND totp_enabled = 1 663 663 LIMIT 1", … … 697 697 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- Updating custom devices table 698 698 $wpdb->query($wpdb->prepare( 699 "UPDATE {$wpdb->prefix} kla_user_devices699 "UPDATE {$wpdb->prefix}chrmrtns_kla_user_devices 700 700 SET totp_failed_attempts = totp_failed_attempts + 1, 701 701 totp_locked_until = CASE … … 763 763 $base_query = "SELECT u.ID, u.user_login, u.user_email, u.display_name, d.totp_enabled, d.totp_last_used, d.totp_failed_attempts, d.totp_locked_until 764 764 FROM {$wpdb->users} u 765 INNER JOIN {$wpdb->prefix} kla_user_devices d ON u.ID = d.user_id AND d.totp_enabled = 1";765 INNER JOIN {$wpdb->prefix}chrmrtns_kla_user_devices d ON u.ID = d.user_id AND d.totp_enabled = 1"; 766 766 767 767 if (!empty($search)) { -
keyless-auth/trunk/keyless-auth.php
r3378019 r3378867 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.7. 26 * Version: 2.7.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.7. 2');40 define('CHRMRTNS_KLA_VERSION', '2.7.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
r3378019 r3378867 6 6 Requires at least: 3.9 7 7 Tested up to: 6.8 8 Stable tag: 2.7. 28 Stable tag: 2.7.3 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 305 305 306 306 == Changelog == 307 = 2.7.3 = 308 * CRITICAL FIX: Magic link token validation - Fixed database table name mismatches causing "token expired" errors 309 * CRITICAL FIX: 2FA grace period redirect - Fixed malformed URL when grace period expires (proper use of add_query_arg) 310 * FIX: Database queries now correctly reference chrmrtns_kla_* tables instead of kla_* tables (10 query fixes) 311 * FIX: Removed unused variable $code_hash in backup code validation function 312 * TECHNICAL: Token validation was querying non-existent kla_login_tokens table instead of chrmrtns_kla_login_tokens 313 * TECHNICAL: Fixed inconsistency between table creation (chrmrtns_kla_*) and queries (kla_*) 314 * IMPACT: Users experiencing immediate token expiration on magic links should now login successfully 315 307 316 = 2.7.2 = 308 317 * FIX: Database table naming - Renamed all tables from kla_* to chrmrtns_kla_* for unique namespace and collision prevention
Note: See TracChangeset
for help on using the changeset viewer.