From 3e4433cd130a61b29a238bf26a863207d74fd5bf Mon Sep 17 00:00:00 2001 From: Javier Casares Date: Mon, 17 Aug 2026 15:55:46 +0000 Subject: [PATCH 01/10] v1.6.2 --- changelog.txt | 26 + includes/admin/class-manager-notice.php | 184 +++ includes/admin/class-settings-page.php | 2 + includes/class-plugin.php | 10 + languages/robotstxt-2fa.pot | 1468 +++++++++++++++++++++++ readme.txt | 40 +- robotstxt-2fa.php | 12 +- robotstxt-updater.php | 384 ------ update.json | 8 +- vendor/composer/autoload_real.php | 2 - vendor/composer/platform_check.php | 25 - 11 files changed, 1720 insertions(+), 441 deletions(-) create mode 100644 includes/admin/class-manager-notice.php create mode 100644 languages/robotstxt-2fa.pot delete mode 100644 robotstxt-updater.php delete mode 100644 vendor/composer/platform_check.php diff --git a/changelog.txt b/changelog.txt index 9552271..5ba5490 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,31 @@ == Changelog == += 1.6.2 = + +_Release date: 2026-08-17_ + +**Added** + +* Recommendation notice for the Manager (by ROBOTSTXT) plugin: when it is not installed and active, a dismissible notice appears on the Plugins screen and a permanent notice is shown on the plugin settings page, since updates are delivered through the Manager plugin. + +**Changed** + +* Updates are now handled by the Manager (by ROBOTSTXT) plugin. The bundled self-updater (robotstxt-updater.php and update.json) has been removed. +* Plugin and update URLs moved to robotstxt.software. +* Minimum WordPress version lowered from 6.4 to 5.6 after a full compatibility review (the code only requires WordPress 5.3+ functions, and WordPress 5.6 is the first release that runs on the required PHP 8.0). + +**Compatibility** + +* WordPress: 5.6 – 7.1 +* PHP: 8.0 – 8.5 + +**Tests** + +* PHP Coding Standards: PHP_CodeSniffer 3.13.6 / WPCS 3.4.1 — 0 errors +* PHPStan: level 9 — 0 errors +* PHPCompatibility: 8.0–8.5 — 0 issues +* PHPUnit: 9.6.36 — 59 tests, 148 assertions + = 1.6.1 = _Release date: 2026-08-14_ diff --git a/includes/admin/class-manager-notice.php b/includes/admin/class-manager-notice.php new file mode 100644 index 0000000..567a166 --- /dev/null +++ b/includes/admin/class-manager-notice.php @@ -0,0 +1,184 @@ +id, array( 'plugins', 'plugins-network' ), true ) ) { + return; + } + + if ( ! current_user_can( 'manage_options' ) ) { + return; + } + + if ( self::is_manager_active() ) { + return; + } + + if ( get_user_meta( get_current_user_id(), self::DISMISSED_META_KEY, true ) ) { + return; + } + + $dismiss_url = wp_nonce_url( + add_query_arg( 'action', self::DISMISS_ACTION, self_admin_url( 'admin.php' ) ), + self::DISMISS_ACTION + ); + ?> +
+

+ + Manager (by ROBOTSTXT) to be installed and active to receive updates.', 'robotstxt-2fa' ), + esc_url( self::MANAGER_URL ) + ) + ); + ?> +

+

+ +

+
+ +
+

+ + Manager (by ROBOTSTXT) to be installed and active to receive updates.', 'robotstxt-2fa' ), + esc_url( self::MANAGER_URL ) + ) + ); + ?> +

+
+ is_network_context() ? network_admin_url( 'edit.php?action=robotstxt_2fa_network_save' ) : 'options.php'; diff --git a/includes/class-plugin.php b/includes/class-plugin.php index da0c9e2..269bd33 100644 --- a/includes/class-plugin.php +++ b/includes/class-plugin.php @@ -8,6 +8,7 @@ namespace Robotstxt\TwoFA; use Robotstxt\TwoFA\Admin\Dashboard_Page; +use Robotstxt\TwoFA\Admin\Manager_Notice; use Robotstxt\TwoFA\Admin\Migration_Page; use Robotstxt\TwoFA\Admin\Settings_Page; use Robotstxt\TwoFA\Cli\Cli_Command; @@ -134,6 +135,13 @@ class Plugin { */ private Migration_Page $migration_page; + /** + * Manager plugin dependency notice. + * + * @var Manager_Notice + */ + private Manager_Notice $manager_notice; + /** * REST API controller. * @@ -174,6 +182,7 @@ class Plugin { $this->geoip_updater = new GeoIP_Updater( $config ); $this->dashboard_page = new Dashboard_Page( $this->attempts_log, $config, $repository ); $this->migration_page = new Migration_Page(); + $this->manager_notice = new Manager_Notice(); $this->rest_controller = new Rest_Controller(); } @@ -191,6 +200,7 @@ class Plugin { $this->geoip_updater->register_hooks(); $this->dashboard_page->register_hooks(); $this->migration_page->register_hooks(); + $this->manager_notice->register_hooks(); $this->rest_controller->register_hooks(); $this->login_manager->register_hooks(); $this->profile_settings->register_hooks(); diff --git a/languages/robotstxt-2fa.pot b/languages/robotstxt-2fa.pot new file mode 100644 index 0000000..d878a91 --- /dev/null +++ b/languages/robotstxt-2fa.pot @@ -0,0 +1,1468 @@ +# Copyright (C) 2026 ROBOTSTXT +# This file is distributed under the GPLv3 or later. +msgid "" +msgstr "" +"Project-Id-Version: 2FA (by ROBOTSTXT) 1.6.2\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/robotstxt-2fa\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"POT-Creation-Date: 2026-08-17T15:23:09+00:00\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"X-Generator: WP-CLI 2.12.0\n" +"X-Domain: robotstxt-2fa\n" + +#. Plugin Name of the plugin +#: robotstxt-2fa.php +#: includes/admin/class-dashboard-page.php:106 +#: includes/admin/class-settings-page.php:1143 +msgid "2FA (by ROBOTSTXT)" +msgstr "" + +#. Plugin URI of the plugin +#: robotstxt-2fa.php +msgid "https://www.robotstxt.software/plugins/robotstxt-2fa/" +msgstr "" + +#. Description of the plugin +#: robotstxt-2fa.php +msgid "Adds two-factor authentication to the WordPress login flow." +msgstr "" + +#. Author of the plugin +#: robotstxt-2fa.php +msgid "ROBOTSTXT" +msgstr "" + +#. Author URI of the plugin +#: robotstxt-2fa.php +msgid "https://www.robotstxt.software/" +msgstr "" + +#: includes/admin/class-dashboard-page.php:107 +#: includes/admin/class-dashboard-page.php:361 +#: includes/admin/class-settings-page.php:1144 +msgid "2FA" +msgstr "" + +#: includes/admin/class-dashboard-page.php:116 +msgid "Dashboard — 2FA" +msgstr "" + +#: includes/admin/class-dashboard-page.php:117 +msgid "Dashboard" +msgstr "" + +#: includes/admin/class-dashboard-page.php:133 +#: includes/admin/class-dashboard-page.php:248 +#: includes/admin/class-migration-page.php:236 +#: includes/admin/class-settings-page.php:99 +#: includes/admin/class-settings-page.php:1073 +#: includes/admin/class-settings-page.php:1532 +msgid "Sorry, you are not allowed to access this page." +msgstr "" + +#: includes/admin/class-dashboard-page.php:165 +msgid "Two-Factor Authentication Dashboard" +msgstr "" + +#: includes/admin/class-dashboard-page.php:170 +msgid "Total users" +msgstr "" + +#: includes/admin/class-dashboard-page.php:174 +msgid "2FA enabled" +msgstr "" + +#: includes/admin/class-dashboard-page.php:178 +msgid "Failed attempts (7 days)" +msgstr "" + +#: includes/admin/class-dashboard-page.php:182 +msgid "Users" +msgstr "" + +#: includes/admin/class-dashboard-page.php:199 +#: includes/admin/class-users-list-table.php:180 +msgid "Export CSV" +msgstr "" + +#: includes/admin/class-dashboard-page.php:203 +msgid "Recent failed attempts" +msgstr "" + +#: includes/admin/class-dashboard-page.php:206 +msgid "No failed attempts recorded." +msgstr "" + +#: includes/admin/class-dashboard-page.php:211 +msgid "Date/Time" +msgstr "" + +#: includes/admin/class-dashboard-page.php:212 +#: includes/admin/class-migration-page.php:282 +#: includes/admin/class-users-list-table.php:70 +msgid "User" +msgstr "" + +#: includes/admin/class-dashboard-page.php:213 +msgid "Method" +msgstr "" + +#: includes/admin/class-dashboard-page.php:214 +msgid "IP" +msgstr "" + +#: includes/admin/class-dashboard-page.php:231 +msgid "View all users →" +msgstr "" + +#: includes/admin/class-dashboard-page.php:386 +#: includes/admin/class-users-list-table.php:349 +msgid "Active" +msgstr "" + +#: includes/admin/class-dashboard-page.php:389 +msgid "Off" +msgstr "" + +#: includes/admin/class-manager-notice.php:108 +#: includes/admin/class-migration-page.php:173 +msgid "2FA (by ROBOTSTXT):" +msgstr "" + +#. translators: %s: URL of the Manager (by ROBOTSTXT) plugin page. +#: includes/admin/class-manager-notice.php:113 +#: includes/admin/class-manager-notice.php:145 +#, php-format +msgid "This plugin needs Manager (by ROBOTSTXT) to be installed and active to receive updates." +msgstr "" + +#: includes/admin/class-manager-notice.php:120 +msgid "Dismiss this notice" +msgstr "" + +#: includes/admin/class-manager-notice.php:140 +msgid "Manager (by ROBOTSTXT) is not active." +msgstr "" + +#: includes/admin/class-migration-page.php:125 +msgid "Import / Migration — 2FA" +msgstr "" + +#: includes/admin/class-migration-page.php:126 +msgid "Import" +msgstr "" + +#. translators: %d: number of users +#: includes/admin/class-migration-page.php:177 +#, php-format +msgid "%d user has an authenticator app secret from another 2FA plugin. Import it so they keep using the same app without reconfiguring." +msgid_plural "%d users have authenticator app secrets from another 2FA plugin. Import them so they keep using the same app without reconfiguring." +msgstr[0] "" +msgstr[1] "" + +#: includes/admin/class-migration-page.php:187 +msgid "Go to import tool →" +msgstr "" + +#: includes/admin/class-migration-page.php:190 +msgid "Dismiss for 7 days" +msgstr "" + +#: includes/admin/class-migration-page.php:244 +msgid "Import — Two-Factor Authentication" +msgstr "" + +#: includes/admin/class-migration-page.php:250 +msgid "Importable users" +msgstr "" + +#: includes/admin/class-migration-page.php:253 +msgid "No importable secrets found. Either no supported plugin is installed, no users have a configured authenticator app, or all secrets have already been imported." +msgstr "" + +#. translators: %d: number of users +#: includes/admin/class-migration-page.php:259 +#, php-format +msgid "Found %d user with an authenticator app secret that has not yet been imported." +msgid_plural "Found %d users with authenticator app secrets that have not yet been imported." +msgstr[0] "" +msgstr[1] "" + +#: includes/admin/class-migration-page.php:270 +msgid "The secret key is transferred directly — users will not need to reconfigure their authenticator app." +msgstr "" + +#: includes/admin/class-migration-page.php:283 +msgid "Email" +msgstr "" + +#: includes/admin/class-migration-page.php:284 +#: includes/admin/class-settings-page.php:407 +#: includes/admin/class-users-list-table.php:71 +msgid "Role" +msgstr "" + +#: includes/admin/class-migration-page.php:285 +msgid "Source plugin" +msgstr "" + +#. translators: %d: number of users +#: includes/admin/class-migration-page.php:319 +#, php-format +msgid "Import selected (%d)" +msgstr "" + +#: includes/admin/class-migration-page.php:364 +#: includes/admin/class-migration-page.php:432 +msgid "Sorry, you are not allowed to perform this action." +msgstr "" + +#: includes/admin/class-migration-page.php:801 +msgid "Two Factor (community)" +msgstr "" + +#: includes/admin/class-migration-page.php:802 +msgid "WP 2FA (Melapress)" +msgstr "" + +#: includes/admin/class-migration-page.php:803 +msgid "Wordfence Login Security" +msgstr "" + +#: includes/admin/class-migration-page.php:860 +msgid "Notice preferences" +msgstr "" + +#: includes/admin/class-migration-page.php:861 +msgid "Control how the migration banner behaves in the admin area." +msgstr "" + +#: includes/admin/class-migration-page.php:869 +msgid "Admin notice" +msgstr "" + +#: includes/admin/class-migration-page.php:879 +msgid "Permanently hide the migration notice in the admin area." +msgstr "" + +#: includes/admin/class-migration-page.php:881 +msgid "When unchecked, the notice appears until all importable secrets have been processed. Use the \"Dismiss for 7 days\" link in the notice for a temporary hide." +msgstr "" + +#: includes/admin/class-migration-page.php:886 +msgid "Save preferences" +msgstr "" + +#. translators: %d: number of secrets imported +#: includes/admin/class-migration-page.php:916 +#, php-format +msgid "✓ %d secret imported and OTP method activated." +msgid_plural "✓ %d secrets imported and OTP method activated." +msgstr[0] "" +msgstr[1] "" + +#. translators: %d: number of users skipped +#: includes/admin/class-migration-page.php:934 +#, php-format +msgid "%d user skipped (secret already present)." +msgid_plural "%d users skipped (secret already present)." +msgstr[0] "" +msgstr[1] "" + +#. translators: %d: number of users that could not be imported +#: includes/admin/class-migration-page.php:952 +#, php-format +msgid "✗ %d user could not be imported (invalid, encrypted, or missing secret)." +msgid_plural "✗ %d users could not be imported (invalid, encrypted, or missing secret)." +msgstr[0] "" +msgstr[1] "" + +#: includes/admin/class-migration-page.php:964 +msgid "No users were selected for import." +msgstr "" + +#: includes/admin/class-settings-page.php:111 +msgid "Two-Factor Authentication settings" +msgstr "" + +#: includes/admin/class-settings-page.php:146 +msgid "General options" +msgstr "" + +#: includes/admin/class-settings-page.php:153 +msgid "Required methods per role" +msgstr "" + +#: includes/admin/class-settings-page.php:161 +#: includes/user/class-profile-settings.php:539 +msgid "Verification frequency" +msgstr "" + +#: includes/admin/class-settings-page.php:169 +msgid "Enforce frequency" +msgstr "" + +#: includes/admin/class-settings-page.php:177 +msgid "Security" +msgstr "" + +#: includes/admin/class-settings-page.php:184 +msgid "Max failed attempts" +msgstr "" + +#: includes/admin/class-settings-page.php:192 +msgid "Lockout duration" +msgstr "" + +#: includes/admin/class-settings-page.php:200 +msgid "Trust browser for" +msgstr "" + +#: includes/admin/class-settings-page.php:208 +msgid "Grace period" +msgstr "" + +#: includes/admin/class-settings-page.php:216 +msgid "After grace period" +msgstr "" + +#: includes/admin/class-settings-page.php:224 +msgid "Data management" +msgstr "" + +#: includes/admin/class-settings-page.php:231 +msgid "Delete data on uninstall" +msgstr "" + +#: includes/admin/class-settings-page.php:239 +msgid "Access control" +msgstr "" + +#: includes/admin/class-settings-page.php:246 +msgid "Application Passwords" +msgstr "" + +#: includes/admin/class-settings-page.php:254 +msgid "Require 2FA to create Application Passwords" +msgstr "" + +#: includes/admin/class-settings-page.php:262 +msgid "IP allow list" +msgstr "" + +#: includes/admin/class-settings-page.php:270 +msgid "IP deny list" +msgstr "" + +#: includes/admin/class-settings-page.php:278 +msgid "Email notifications" +msgstr "" + +#: includes/admin/class-settings-page.php:285 +msgid "On method activation" +msgstr "" + +#: includes/admin/class-settings-page.php:293 +msgid "New location" +msgstr "" + +#: includes/admin/class-settings-page.php:301 +msgid "Recovery code used" +msgstr "" + +#: includes/admin/class-settings-page.php:309 +msgid "Activity digest" +msgstr "" + +#: includes/admin/class-settings-page.php:317 +msgid "GeoIP / Country restrictions" +msgstr "" + +#: includes/admin/class-settings-page.php:324 +msgid "Database path" +msgstr "" + +#: includes/admin/class-settings-page.php:332 +msgid "Auto database" +msgstr "" + +#: includes/admin/class-settings-page.php:340 +msgid "Country allow list (bypass 2FA)" +msgstr "" + +#: includes/admin/class-settings-page.php:348 +msgid "Country deny list (block login)" +msgstr "" + +#: includes/admin/class-settings-page.php:356 +msgid "Always challenge countries" +msgstr "" + +#: includes/admin/class-settings-page.php:369 +msgid "Control how two-factor authentication is enforced for user roles." +msgstr "" + +#: includes/admin/class-settings-page.php:372 +msgid "These settings are locked by a network administrator. Any changes made here will be ignored." +msgstr "" + +#: includes/admin/class-settings-page.php:394 +msgid "No editable roles were found." +msgstr "" + +#: includes/admin/class-settings-page.php:399 +#: includes/user/class-profile-settings.php:279 +#: includes/user/class-profile-settings.php:1346 +msgid "Email code" +msgstr "" + +#: includes/admin/class-settings-page.php:400 +msgid "Authenticator app" +msgstr "" + +#: includes/admin/class-settings-page.php:401 +#: includes/user/class-profile-settings.php:1354 +msgid "Recovery codes" +msgstr "" + +#: includes/admin/class-settings-page.php:420 +#: includes/admin/class-settings-page.php:470 +msgid "All" +msgstr "" + +#: includes/admin/class-settings-page.php:427 +msgid "All methods" +msgstr "" + +#. translators: 1: role name, 2: method name. +#: includes/admin/class-settings-page.php:443 +#, php-format +msgid "%1$s: require %2$s" +msgstr "" + +#: includes/admin/class-settings-page.php:479 +msgid "Check which verification methods are required for each role. Users assigned to a role with at least one checked method must complete two-factor authentication using one of those methods. Roles with no methods checked leave the choice to the user." +msgstr "" + +#: includes/admin/class-settings-page.php:573 +msgid "You are not allowed to update these settings." +msgstr "" + +#: includes/admin/class-settings-page.php:924 +msgid "Prevent users from overriding the global verification frequency." +msgstr "" + +#: includes/admin/class-settings-page.php:927 +msgid "When enabled, users will see the profile frequency control disabled and must follow the global schedule." +msgstr "" + +#: includes/admin/class-settings-page.php:936 +msgid "Brute-force protection, trusted device cookies, and grace period for new enrollments." +msgstr "" + +#: includes/admin/class-settings-page.php:950 +msgid "(0 = unlimited)" +msgstr "" + +#: includes/admin/class-settings-page.php:952 +msgid "Number of consecutive failed 2FA attempts before the user is temporarily locked out. The lock is cleared after the lockout duration expires." +msgstr "" + +#: includes/admin/class-settings-page.php:966 +msgid "minutes" +msgstr "" + +#: includes/admin/class-settings-page.php:968 +msgid "How long the account is locked after too many failed attempts. Applies only when Max failed attempts is greater than 0." +msgstr "" + +#: includes/admin/class-settings-page.php:982 +msgid "days (0 = disable trusted devices)" +msgstr "" + +#: includes/admin/class-settings-page.php:984 +msgid "When greater than 0, the \"Remember this browser\" checkbox is available after a successful 2FA verification. The trust duration is taken from each user's verification frequency (daily, weekly, or monthly), so the checkbox always complies with their profile setting. Set to 0 to disable the feature." +msgstr "" + +#: includes/admin/class-settings-page.php:998 +msgid "days (0 = no grace period)" +msgstr "" + +#: includes/admin/class-settings-page.php:1000 +msgid "Users whose role requires 2FA but who have not yet configured any method are allowed to log in for this many days before enforcement begins. The timer starts on their first login after the role requirement is applied." +msgstr "" + +#: includes/admin/class-settings-page.php:1017 +msgid "Block login — the user cannot access the dashboard until an administrator enables a method for them." +msgstr "" + +#: includes/admin/class-settings-page.php:1023 +msgid "Forced setup — the user can log in but is redirected to the 2FA profile section on every page until at least one method is confirmed." +msgstr "" + +#: includes/admin/class-settings-page.php:1034 +msgid "Control what happens to plugin data when the plugin is deleted." +msgstr "" + +#: includes/admin/class-settings-page.php:1055 +msgid "Remove all plugin data when the plugin is deleted." +msgstr "" + +#: includes/admin/class-settings-page.php:1058 +msgid "When checked, deleting this plugin will permanently remove all settings, per-user 2FA preferences, stored secrets, recovery codes, and verification history. This action cannot be undone. Leave unchecked (default) to preserve all data if you reinstall later." +msgstr "" + +#: includes/admin/class-settings-page.php:1154 +#: includes/admin/class-settings-page.php:1173 +msgid "Settings — 2FA" +msgstr "" + +#: includes/admin/class-settings-page.php:1155 +#: includes/admin/class-settings-page.php:1174 +msgid "Settings" +msgstr "" + +#: includes/admin/class-settings-page.php:1163 +#: includes/admin/class-settings-page.php:1182 +msgid "Documentation — 2FA" +msgstr "" + +#: includes/admin/class-settings-page.php:1164 +#: includes/admin/class-settings-page.php:1183 +msgid "Documentation" +msgstr "" + +#: includes/admin/class-settings-page.php:1197 +msgid "Application Passwords, IP allow lists and deny lists." +msgstr "" + +#: includes/admin/class-settings-page.php:1218 +msgid "Exempt Application Password requests from the 2FA challenge" +msgstr "" + +#: includes/admin/class-settings-page.php:1221 +msgid "Application Password requests cannot complete browser-based 2FA challenges. Enable to let REST API and WP-CLI clients using Application Passwords skip the verification step." +msgstr "" + +#: includes/admin/class-settings-page.php:1238 +msgid "One IP address or CIDR range per line (e.g. 192.168.1.0/24). Requests from these IPs skip the 2FA challenge." +msgstr "" + +#: includes/admin/class-settings-page.php:1255 +msgid "One IP address or CIDR range per line. Login is blocked outright for these IPs." +msgstr "" + +#: includes/admin/class-settings-page.php:1264 +msgid "Automatic email alerts for security-relevant events." +msgstr "" + +#: includes/admin/class-settings-page.php:1279 +msgid "Notify the user when an administrator enables 2FA for their account." +msgstr "" + +#: includes/admin/class-settings-page.php:1295 +msgid "Notify the user on login from an unrecognised browser or IP." +msgstr "" + +#: includes/admin/class-settings-page.php:1311 +msgid "Notify user when a recovery code is used." +msgstr "" + +#: includes/admin/class-settings-page.php:1320 +msgid "Also notify site administrator." +msgstr "" + +#: includes/admin/class-settings-page.php:1337 +msgid "Send a periodic activity digest to site administrators." +msgstr "" + +#: includes/admin/class-settings-page.php:1346 +#: includes/class-frequency-options.php:54 +msgid "Weekly" +msgstr "" + +#: includes/admin/class-settings-page.php:1353 +msgid "Monthly (every 30 days)" +msgstr "" + +#: includes/admin/class-settings-page.php:1377 +msgid "Require a recent 2FA verification before creating a new Application Password." +msgstr "" + +#: includes/admin/class-settings-page.php:1380 +msgid "When enabled, users must have completed a 2FA challenge within the last 15 minutes before they can generate a new Application Password via the REST API." +msgstr "" + +#: includes/admin/class-settings-page.php:1389 +msgid "Requires a MaxMind GeoLite2 Country database file (.mmdb). Leave empty to disable country-based rules. Download the free GeoLite2 Country database from maxmind.com." +msgstr "" + +#: includes/admin/class-settings-page.php:1406 +msgid "Absolute path to the GeoLite2-Country.mmdb file. Leave empty to disable GeoIP features." +msgstr "" + +#: includes/admin/class-settings-page.php:1425 +msgid "Use the free ROBOTSTXT GeoIP database (auto-updated daily)" +msgstr "" + +#: includes/admin/class-settings-page.php:1428 +msgid "When enabled, the country database is downloaded from ip.robotstxt.es into your uploads directory and refreshed every day by the WordPress cron. This overrides the manual database path above." +msgstr "" + +#: includes/admin/class-settings-page.php:1436 +msgid "Update now" +msgstr "" + +#. translators: %s: formatted date/time of last update. +#: includes/admin/class-settings-page.php:1448 +#, php-format +msgid "Last update: %s." +msgstr "" + +#. translators: %s: formatted date/time of last attempt. +#: includes/admin/class-settings-page.php:1454 +#, php-format +msgid "Last attempt failed on %s." +msgstr "" + +#: includes/admin/class-settings-page.php:1461 +msgid "No download has run yet. Click \"Update now\" or wait for the next cron run." +msgstr "" + +#: includes/admin/class-settings-page.php:1465 +msgid "The database has not been downloaded yet." +msgstr "" + +#: includes/admin/class-settings-page.php:1486 +msgid "ISO country codes (one per line, e.g. ES, US) whose logins bypass the 2FA challenge." +msgstr "" + +#: includes/admin/class-settings-page.php:1503 +msgid "ISO country codes blocked from logging in altogether." +msgstr "" + +#: includes/admin/class-settings-page.php:1520 +msgid "ISO country codes that always trigger a 2FA challenge, regardless of the verification frequency setting." +msgstr "" + +#: includes/admin/class-settings-page.php:1536 +msgid "Documentation — 2FA (by ROBOTSTXT)" +msgstr "" + +#: includes/admin/class-settings-page.php:1537 +msgid "Reference for developers: all actions, filters, and shortcodes exposed by the plugin." +msgstr "" + +#: includes/admin/class-settings-page.php:1539 +msgid "Shortcode" +msgstr "" + +#: includes/admin/class-settings-page.php:1540 +msgid "Renders the full 2FA settings section on any page or post without requiring wp-admin access. Useful for membership sites with a frontend dashboard." +msgstr "" + +#: includes/admin/class-settings-page.php:1544 +msgid "Attribute" +msgstr "" + +#: includes/admin/class-settings-page.php:1544 +#: includes/admin/class-settings-page.php:1587 +msgid "Default" +msgstr "" + +#: includes/admin/class-settings-page.php:1544 +#: includes/admin/class-settings-page.php:1557 +#: includes/admin/class-settings-page.php:1588 +msgid "Description" +msgstr "" + +#: includes/admin/class-settings-page.php:1546 +msgid "Current user" +msgstr "" + +#: includes/admin/class-settings-page.php:1546 +msgid "ID of the user to edit. Admins can specify another user." +msgstr "" + +#: includes/admin/class-settings-page.php:1547 +msgid "Current page" +msgstr "" + +#: includes/admin/class-settings-page.php:1547 +msgid "URL to redirect to after a successful save." +msgstr "" + +#: includes/admin/class-settings-page.php:1551 +msgid "Action hooks" +msgstr "" + +#: includes/admin/class-settings-page.php:1554 +msgid "Hook" +msgstr "" + +#: includes/admin/class-settings-page.php:1555 +#: includes/admin/class-settings-page.php:1586 +msgid "Since" +msgstr "" + +#: includes/admin/class-settings-page.php:1556 +msgid "Arguments" +msgstr "" + +#: includes/admin/class-settings-page.php:1562 +msgid "Fires just before the email verification code is delivered." +msgstr "" + +#: includes/admin/class-settings-page.php:1563 +msgid "Fires after a successful 2FA challenge. Use for audit logs or trusted-device recording." +msgstr "" + +#: includes/admin/class-settings-page.php:1564 +msgid "Fires on each failed 2FA attempt. Use for rate-limiting or alerting." +msgstr "" + +#: includes/admin/class-settings-page.php:1565 +msgid "Fires when a user activates a method from their profile." +msgstr "" + +#: includes/admin/class-settings-page.php:1566 +msgid "Fires when a user deactivates a method from their profile." +msgstr "" + +#: includes/admin/class-settings-page.php:1567 +msgid "Fires when QR code SVG rendering throws an exception." +msgstr "" + +#: includes/admin/class-settings-page.php:1568 +msgid "Fires when recovery code generation throws an exception." +msgstr "" + +#: includes/admin/class-settings-page.php:1582 +msgid "Filter hooks" +msgstr "" + +#: includes/admin/class-settings-page.php:1585 +#: includes/admin/class-users-list-table.php:353 +msgid "Filter" +msgstr "" + +#: includes/admin/class-settings-page.php:1593 +msgid "Return true to bypass the 2FA challenge entirely (REST API, WP-CLI, trusted IP…)." +msgstr "" + +#: includes/admin/class-settings-page.php:1594 +msgid "Override the required methods for a specific user; receives current role-based array and WP_User." +msgstr "" + +#: includes/admin/class-settings-page.php:1595 +msgid "Number of digits in the email verification code." +msgstr "" + +#: includes/admin/class-settings-page.php:1596 +msgid "Seconds before an email verification code expires." +msgstr "" + +#: includes/admin/class-settings-page.php:1597 +msgid "Minimum seconds between email resend requests." +msgstr "" + +#: includes/admin/class-settings-page.php:1598 +msgid "Subject line of the verification code email. Receives subject and WP_User." +msgstr "" + +#: includes/admin/class-settings-page.php:1599 +msgid "Body of the verification code email. Receives message, WP_User, and plain-text code." +msgstr "" + +#: includes/admin/class-settings-page.php:1600 +msgid "CSS class on the [robotstxt_2fa_profile] shortcode container." +msgstr "" + +#. translators: %s: link to hooks.md file. +#: includes/admin/class-settings-page.php:1618 +#, php-format +msgid "Full documentation with code examples: %s" +msgstr "" + +#: includes/admin/class-users-list-table.php:72 +msgid "2FA Status" +msgstr "" + +#: includes/admin/class-users-list-table.php:73 +msgid "Methods" +msgstr "" + +#: includes/admin/class-users-list-table.php:74 +msgid "Last verified" +msgstr "" + +#: includes/admin/class-users-list-table.php:75 +msgid "Unused codes" +msgstr "" + +#: includes/admin/class-users-list-table.php:340 +msgid "— All roles —" +msgstr "" + +#: includes/admin/class-users-list-table.php:348 +msgid "— All statuses —" +msgstr "" + +#: includes/admin/class-users-list-table.php:350 +msgid "Required (not set up)" +msgstr "" + +#: includes/admin/class-users-list-table.php:351 +msgid "Optional (disabled)" +msgstr "" + +#: includes/class-email-notifications.php:78 +msgid "Every 30 days" +msgstr "" + +#. translators: %s: site name. +#: includes/class-email-notifications.php:141 +#, php-format +msgid "[%s] Two-factor authentication has been activated on your account" +msgstr "" + +#. translators: 1: display name, 2: site name, 3: login URL. +#: includes/class-email-notifications.php:147 +#, php-format +msgid "" +"Hi %1$s,\n" +"\n" +"An administrator has enabled two-factor authentication on your account at %2$s.\n" +"\n" +"You can review and configure your two-factor preferences from your profile page:\n" +"%3$s\n" +"\n" +"If you did not expect this change, please contact the site administrator.\n" +"\n" +"-- %2$s" +msgstr "" + +#. translators: %s: site name. +#: includes/class-email-notifications.php:201 +#, php-format +msgid "[%s] New login to your account" +msgstr "" + +#. translators: 1: display name, 2: site name, 3: date/time, 4: anonymized IP. +#: includes/class-email-notifications.php:207 +#, php-format +msgid "" +"Hi %1$s,\n" +"\n" +"A new login to your account at %2$s was detected from an unrecognised browser or location.\n" +"\n" +"Date/time: %3$s\n" +"IP address: %4$s\n" +"\n" +"If this was you, no action is needed.\n" +"If you do not recognise this login, please change your password and contact the site administrator immediately.\n" +"\n" +"-- %2$s" +msgstr "" + +#. translators: %s: site name. +#: includes/class-email-notifications.php:247 +#, php-format +msgid "[%s] A recovery code was used to access your account" +msgstr "" + +#. translators: 1: display name, 2: site name, 3: date/time. +#: includes/class-email-notifications.php:253 +#, php-format +msgid "" +"Hi %1$s,\n" +"\n" +"One of your two-factor recovery codes was used to log in to %2$s.\n" +"\n" +"Date/time: %3$s\n" +"\n" +"If this was you, no action is needed. Recovery codes are single-use; the code has now been consumed.\n" +"If you do not recognise this activity, please contact your site administrator immediately.\n" +"\n" +"-- %2$s" +msgstr "" + +#. translators: %s: site name. +#: includes/class-email-notifications.php:280 +#, php-format +msgid "[%s] A recovery code was used — administrator notice" +msgstr "" + +#. translators: 1: user display name, 2: user login, 3: site name, 4: date/time. +#: includes/class-email-notifications.php:286 +#, php-format +msgid "" +"Administrator notice from %3$s:\n" +"\n" +"User \"%1$s\" (%2$s) used a recovery code to log in.\n" +"\n" +"Date/time: %4$s\n" +"\n" +"Please verify this was an expected action.\n" +"\n" +"-- %3$s" +msgstr "" + +#. translators: %s: site name. +#: includes/class-email-notifications.php:346 +#, php-format +msgid "2FA activity digest — %s" +msgstr "" + +#. translators: 1: site name, 2: total users, 3: users with 2FA, 4: failed attempts last 7 days. +#: includes/class-email-notifications.php:352 +#, php-format +msgid "" +"Two-factor authentication activity digest for %1$s\n" +"\n" +"Total registered users: %2$d\n" +"Users with 2FA configured: %3$d\n" +"Failed 2FA attempts (last 7 days): %4$d\n" +"\n" +"-- %1$s" +msgstr "" + +#: includes/class-frequency-options.php:46 +msgid "Every login" +msgstr "" + +#: includes/class-frequency-options.php:47 +msgid "Always require a new verification code after the password step." +msgstr "" + +#: includes/class-frequency-options.php:50 +msgid "Daily" +msgstr "" + +#: includes/class-frequency-options.php:51 +msgid "Remember successful verifications for 24 hours per device." +msgstr "" + +#: includes/class-frequency-options.php:55 +msgid "Remember successful verifications for 7 days per device." +msgstr "" + +#: includes/class-frequency-options.php:58 +msgid "Monthly" +msgstr "" + +#: includes/class-frequency-options.php:59 +msgid "Remember successful verifications for 28 days per device." +msgstr "" + +#: includes/class-geo-restrictions.php:112 +msgid "Login is not allowed from your country." +msgstr "" + +#: includes/class-geoip-updater.php:129 +msgid "The uploads directory is not writable." +msgstr "" + +#: includes/class-geoip-updater.php:136 +msgid "Could not create the storage directory for the GeoIP database." +msgstr "" + +#. translators: %d: HTTP response code. +#: includes/class-geoip-updater.php:158 +#, php-format +msgid "Download failed (HTTP %d)." +msgstr "" + +#: includes/class-geoip-updater.php:163 +msgid "The downloaded file is not a valid MaxMind database." +msgstr "" + +#: includes/class-geoip-updater.php:171 +msgid "Could not write the GeoIP database file." +msgstr "" + +#: includes/class-geoip-updater.php:177 +msgid "Could not finalize the GeoIP database file." +msgstr "" + +#: includes/class-geoip-updater.php:248 +msgid "Sorry, you are not allowed to do this." +msgstr "" + +#: includes/class-ip-restrictions.php:109 +msgid "Access denied. Your IP address is not allowed to log in." +msgstr "" + +#: includes/class-plugin.php:291 +msgid "A recent two-factor authentication verification is required to create an Application Password. Please log in and complete 2FA, then try again." +msgstr "" + +#. translators: %s: site name. +#: includes/login/class-email-code-sender.php:137 +#, php-format +msgid "[%s] Your verification code" +msgstr "" + +#. translators: %s: site name. +#: includes/login/class-email-code-sender.php:137 +msgid "WordPress" +msgstr "" + +#. translators: %s: user display name. +#: includes/login/class-email-code-sender.php:151 +#, php-format +msgid "Hi %s," +msgstr "" + +#. translators: %s: site name. +#: includes/login/class-email-code-sender.php:154 +#, php-format +msgid "Use the following verification code to finish signing in to %s:" +msgstr "" + +#. translators: %s: site name. +#: includes/login/class-email-code-sender.php:154 +msgid "your site" +msgstr "" + +#: includes/login/class-email-code-sender.php:158 +msgid "The code expires in 10 minutes." +msgstr "" + +#: includes/login/class-email-code-sender.php:160 +msgid "If you did not request this code you can ignore this email." +msgstr "" + +#: includes/login/class-login-form-manager.php:276 +msgid "Verification code" +msgstr "" + +#. translators: %d: verification code length. +#: includes/login/class-login-form-manager.php:287 +#, php-format +msgid "Enter the %d-digit code from your authenticator app." +msgstr "" + +#. translators: %d: verification code length. +#: includes/login/class-login-form-manager.php:294 +#, php-format +msgid "Enter one of your %d-character recovery codes." +msgstr "" + +#. translators: %d: verification code length. +#: includes/login/class-login-form-manager.php:302 +#, php-format +msgid "Enter the %d-digit verification code we sent to your email." +msgstr "" + +#. translators: %d: number of days the device trust lasts. +#: includes/login/class-login-form-manager.php:323 +#, php-format +msgid "Remember this browser for %d day" +msgid_plural "Remember this browser for %d days" +msgstr[0] "" +msgstr[1] "" + +#: includes/login/class-login-form-manager.php:353 +msgid "Send the code again" +msgstr "" + +#: includes/login/class-login-form-manager.php:362 +msgid "Back to login" +msgstr "" + +#: includes/login/class-login-form-manager.php:429 +msgid "We sent a verification code to your email. Enter it below to continue." +msgstr "" + +#: includes/login/class-login-form-manager.php:432 +msgid "We sent you a fresh verification code. Check your inbox." +msgstr "" + +#: includes/login/class-login-form-manager.php:434 +msgid "We could not send a new verification code. Please try again in a moment." +msgstr "" + +#: includes/login/class-login-form-manager.php:437 +msgid "Open your authenticator app and enter the code to continue." +msgstr "" + +#: includes/login/class-login-form-manager.php:439 +msgid "Enter one of your unused recovery codes to continue." +msgstr "" + +#: includes/login/class-login-form-manager.php:507 +msgid "Verify code" +msgstr "" + +#: includes/login/class-login-form-manager.php:568 +msgid "The verification form is missing a security token. Please try again." +msgstr "" + +#: includes/login/class-login-form-manager.php:574 +msgid "The verification request expired. Please sign in again to request a new code." +msgstr "" + +#: includes/login/class-login-form-manager.php:580 +msgid "We could not determine which account you are trying to access." +msgstr "" + +#. translators: %d: minutes remaining. +#: includes/login/class-login-form-manager.php:594 +#, php-format +msgid "Too many failed attempts. Please try again in %d minute." +msgid_plural "Too many failed attempts. Please try again in %d minutes." +msgstr[0] "" +msgstr[1] "" + +#: includes/login/class-login-form-manager.php:608 +msgid "Your verification session expired. Please sign in again." +msgstr "" + +#: includes/login/class-login-form-manager.php:615 +#: includes/login/class-login-form-manager.php:645 +msgid "The selected verification method is not available right now." +msgstr "" + +#: includes/login/class-login-form-manager.php:625 +msgid "Enter the verification code to continue." +msgstr "" + +#: includes/login/class-login-form-manager.php:675 +msgid "The verification code is incorrect or has expired." +msgstr "" + +#: includes/login/class-login-form-manager.php:799 +msgid "Your account requires two-factor authentication. Please contact your administrator to complete the setup." +msgstr "" + +#: includes/login/class-login-form-manager.php:812 +msgid "We could not send a verification code. Please contact the site administrator." +msgstr "" + +#: includes/login/class-login-form-manager.php:1189 +msgid "Use an email code instead" +msgstr "" + +#: includes/login/class-login-form-manager.php:1190 +msgid "Use your authenticator app instead" +msgstr "" + +#: includes/login/class-login-form-manager.php:1191 +msgid "Use a recovery code instead" +msgstr "" + +#: includes/rest/class-rest-controller.php:132 +msgid "Restrict the list to a single role slug." +msgstr "" + +#: includes/rest/class-rest-controller.php:137 +msgid "Filter by 2FA status: enabled, required, or disabled." +msgstr "" + +#: includes/rest/class-rest-controller.php:155 +msgid "You are not allowed to manage 2FA settings." +msgstr "" + +#: includes/user/class-frontend-profile.php:168 +msgid "Save" +msgstr "" + +#: includes/user/class-frontend-profile.php:211 +#: includes/user/class-profile-settings.php:165 +msgid "The recovery codes have been copied to your clipboard." +msgstr "" + +#: includes/user/class-frontend-profile.php:212 +#: includes/user/class-profile-settings.php:166 +msgid "Copying failed. Please copy the codes manually." +msgstr "" + +#: includes/user/class-otp-manager.php:177 +msgid "WordPress Site" +msgstr "" + +#. translators: 1: verification method label, 2: email address. +#: includes/user/class-profile-settings.php:284 +#, php-format +msgid "%1$s (%2$s)" +msgstr "" + +#: includes/user/class-profile-settings.php:315 +msgid "Two-Factor Authentication" +msgstr "" + +#: includes/user/class-profile-settings.php:321 +msgid "Status" +msgstr "" + +#: includes/user/class-profile-settings.php:326 +msgid "Two-factor authentication status" +msgstr "" + +#: includes/user/class-profile-settings.php:330 +msgid "Enable two-factor authentication for this account." +msgstr "" + +#: includes/user/class-profile-settings.php:334 +msgid "Two-factor authentication is enforced for at least one of your roles and cannot be disabled." +msgstr "" + +#: includes/user/class-profile-settings.php:338 +msgid "You can temporarily disable 2FA if you no longer wish to use the extra verification step." +msgstr "" + +#: includes/user/class-profile-settings.php:346 +msgid "Available methods" +msgstr "" + +#: includes/user/class-profile-settings.php:351 +msgid "Select the two-factor authentication methods you want to enable." +msgstr "" + +#: includes/user/class-profile-settings.php:362 +#: includes/user/class-profile-settings.php:380 +#: includes/user/class-profile-settings.php:428 +msgid "required for your role" +msgstr "" + +#: includes/user/class-profile-settings.php:390 +msgid "The authenticator app is active for this account." +msgstr "" + +#: includes/user/class-profile-settings.php:394 +msgid "Scan the QR code or enter the setup key below in your authenticator app." +msgstr "" + +#: includes/user/class-profile-settings.php:397 +msgid "Authenticator app QR code" +msgstr "" + +#: includes/user/class-profile-settings.php:400 +msgid "Install the QR code library and enable the XMLWriter extension to display the authenticator code image. Run the following command inside this plugin directory:" +msgstr "" + +#: includes/user/class-profile-settings.php:406 +msgid "If your app cannot scan the QR code, enter this setup key manually:" +msgstr "" + +#: includes/user/class-profile-settings.php:411 +msgid "Enter the current six-digit code from your authenticator app to activate this method. Submitting a valid code activates the authenticator app even if the Enable checkbox above is not checked." +msgstr "" + +#: includes/user/class-profile-settings.php:414 +msgid "Authenticator code" +msgstr "" + +#. translators: 1: number of unused codes, 2: total number of codes. +#: includes/user/class-profile-settings.php:440 +#, php-format +msgid "There are %1$d of %2$d recovery codes still unused." +msgstr "" + +#. translators: %s: formatted datetime. +#: includes/user/class-profile-settings.php:451 +#, php-format +msgid "Last generated on %s." +msgstr "" + +#: includes/user/class-profile-settings.php:459 +msgid "Recovery codes are active." +msgstr "" + +#: includes/user/class-profile-settings.php:463 +msgid "Regenerate codes" +msgstr "" + +#: includes/user/class-profile-settings.php:470 +msgid "Copy these recovery codes and store them somewhere safe. Each code works only once." +msgstr "" + +#: includes/user/class-profile-settings.php:479 +msgid "Copy codes" +msgstr "" + +#: includes/user/class-profile-settings.php:482 +msgid "✓ Copied to clipboard" +msgstr "" + +#: includes/user/class-profile-settings.php:488 +msgid "Enter one of the codes above to confirm you saved them:" +msgstr "" + +#: includes/user/class-profile-settings.php:492 +msgid "Once confirmed, the codes disappear from this page but remain valid until you use them." +msgstr "" + +#: includes/user/class-profile-settings.php:499 +msgid "We could not display recovery codes. Save the profile to try generating them again." +msgstr "" + +#: includes/user/class-profile-settings.php:503 +msgid "Choose at least one verification method to keep your account accessible if you lose access to another method." +msgstr "" + +#: includes/user/class-profile-settings.php:507 +msgid "Two-factor authentication is required. Activate at least one method above." +msgstr "" + +#: includes/user/class-profile-settings.php:516 +msgid "Preferred method" +msgstr "" + +#: includes/user/class-profile-settings.php:521 +msgid "Choose which verification method is requested first when you sign in." +msgstr "" + +#: includes/user/class-profile-settings.php:531 +msgid "Choose which method is requested first when you sign in. You can still switch methods on the login screen." +msgstr "" + +#: includes/user/class-profile-settings.php:544 +msgid "Choose how often to request an additional verification step on this device." +msgstr "" + +#: includes/user/class-profile-settings.php:547 +msgid "Frequency" +msgstr "" + +#: includes/user/class-profile-settings.php:561 +msgid "A site administrator enforces this schedule for your account." +msgstr "" + +#: includes/user/class-profile-settings.php:565 +msgid "Successful verifications are remembered per device and connection for the selected duration." +msgstr "" + +#: includes/user/class-profile-settings.php:622 +msgid "Trusted Devices" +msgstr "" + +#: includes/user/class-profile-settings.php:624 +msgid "No trusted devices. Check \"Remember this browser\" after your next verification to trust a device." +msgstr "" + +#: includes/user/class-profile-settings.php:629 +msgid "Device" +msgstr "" + +#: includes/user/class-profile-settings.php:630 +msgid "Trusted since" +msgstr "" + +#: includes/user/class-profile-settings.php:631 +msgid "Expires" +msgstr "" + +#: includes/user/class-profile-settings.php:657 +msgid "Revoke" +msgstr "" + +#: includes/user/class-profile-settings.php:666 +msgid "Revoke all trusted devices" +msgstr "" + +#: includes/user/class-profile-settings.php:706 +msgid "New recovery codes are ready below. Copy them and confirm you saved them by entering one code." +msgstr "" + +#: includes/user/class-profile-settings.php:751 +msgid "All recovery codes were used. Generating a new batch failed. Please try again." +msgstr "" + +#: includes/user/class-profile-settings.php:766 +msgid "All recovery codes were used. We prepared a new batch that must be confirmed below." +msgstr "" + +#: includes/user/class-profile-settings.php:816 +msgid "All trusted devices have been revoked." +msgstr "" + +#: includes/user/class-profile-settings.php:819 +msgid "Trusted device revoked." +msgstr "" + +#: includes/user/class-profile-settings.php:880 +msgid "We could not regenerate recovery codes. Please try again." +msgstr "" + +#: includes/user/class-profile-settings.php:899 +msgid "New recovery codes generated. Copy them and confirm one to activate." +msgstr "" + +#: includes/user/class-profile-settings.php:944 +msgid "Authenticator app disabled. Scan a new QR code below to reconnect it." +msgstr "" + +#: includes/user/class-profile-settings.php:957 +msgid "Enter the six-digit code currently shown in your authenticator app to activate this method." +msgstr "" + +#: includes/user/class-profile-settings.php:967 +msgid "Authenticator app enabled successfully." +msgstr "" + +#: includes/user/class-profile-settings.php:975 +msgid "The provided authenticator code is invalid or expired. Try again with a fresh code." +msgstr "" + +#: includes/user/class-profile-settings.php:997 +msgid "Recovery codes confirmed. Keep them in a secure location." +msgstr "" + +#: includes/user/class-profile-settings.php:1004 +msgid "We could not verify that code. Enter one of the freshly generated recovery codes to confirm." +msgstr "" + +#: includes/user/class-profile-settings.php:1023 +msgid "Recovery codes disabled. A fresh list is available below." +msgstr "" + +#: includes/user/class-profile-settings.php:1035 +msgid "Enter one of the displayed recovery codes to activate this method." +msgstr "" + +#: includes/user/class-profile-settings.php:1326 +msgid "no email address available" +msgstr "" + +#: includes/user/class-profile-settings.php:1338 +msgid "Receive a verification code in your inbox every time you sign in." +msgstr "" + +#: includes/user/class-profile-settings.php:1341 +msgid "Add a valid email address to your profile to receive verification codes." +msgstr "" + +#: includes/user/class-profile-settings.php:1350 +msgid "Authenticator app (OTP)" +msgstr "" + +#: includes/user/class-profile-settings.php:1351 +msgid "Use an app like Google Authenticator or 1Password to generate time-based codes." +msgstr "" + +#: includes/user/class-profile-settings.php:1355 +msgid "Keep printable backup codes in a safe place for emergencies." +msgstr "" + +#: includes/user/class-recovery-codes.php:68 +msgid "You must be logged in to manage recovery codes." +msgstr "" + +#: includes/user/class-recovery-codes.php:96 +#: includes/user/class-recovery-codes.php:116 +msgid "The requested user account could not be found." +msgstr "" + +#: includes/user/class-recovery-codes.php:105 +msgid "You are not allowed to modify recovery codes for this account." +msgstr "" + +#: includes/user/class-recovery-codes.php:135 +msgid "We could not generate recovery codes. Please try again." +msgstr "" diff --git a/readme.txt b/readme.txt index 6eec4a0..fbbe77f 100644 --- a/readme.txt +++ b/readme.txt @@ -1,10 +1,10 @@ === 2FA (by ROBOTSTXT) === -Contributors: robotstxt +Contributors: robotstxt, javiercasares Tags: security, two-factor authentication, login, otp -Requires at least: 6.4 +Requires at least: 5.6 Tested up to: 7.0 Requires PHP: 8.0 -Stable tag: 1.6.1 +Stable tag: 1.6.2 License: GPLv3 or later License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -53,12 +53,26 @@ Yes. Activate the plugin at the network level. Network administrators can set an == Compatibility == -* WordPress: 6.4 – 7.0 +* WordPress: 5.6 – 7.0 * PHP: 8.0 – 8.5 * MariaDB: 11.4 or newer == Changelog == += 1.6.2 = + +_Release date: 2026-08-17_ + +**Added** + +* Recommendation notice for the Manager (by ROBOTSTXT) plugin: when it is not installed and active, a dismissible notice appears on the Plugins screen and a permanent notice is shown on the plugin settings page, since updates are delivered through the Manager plugin. + +**Changed** + +* Updates are now handled by the Manager (by ROBOTSTXT) plugin. The bundled self-updater (`robotstxt-updater.php` and `update.json`) has been removed. +* Plugin and update URLs moved to `robotstxt.software`. +* Minimum WordPress version lowered from 6.4 to 5.6 after a full compatibility review (the code only requires WordPress 5.3+ functions, and WordPress 5.6 is the first release that runs on the required PHP 8.0). + = 1.6.1 = _Release date: 2026-08-14_ @@ -82,25 +96,9 @@ _Release date: 2026-08-07_ * `wp 2fa list` now shows separate **Enabled**, **Methods** (configured), and **Required** (role-enforced) columns, plus a new `--required` filter to list only users whose role enforces 2FA. -= 1.5.3 = - -_Release date: 2026-08-07_ - -**Added** - -* Per-user preferred sign-in method — a new "Preferred method" dropdown on the user profile (visible when two or more methods are enabled) lets each user choose which verification method is requested first at the login screen. Users can still switch methods on the login screen via the existing alternate-method links. - -**Changed** - -* Role enforcement is now a floor, not a ceiling. When a role requires specific methods, those methods are still forced on the user's profile (enforced setup), but at login users may authenticate with any method they have configured — not only the role-required ones. Previously, users who configured extra methods (e.g. an authenticator app) only saw the role-required method at login. - -**Fixed** - -* Security: the "Require 2FA to create Application Passwords" check could be bypassed via the `/wp/v2/users/me/application-passwords` REST route. The route matcher now accepts the `me` alias. - = Previous versions = -For the full changelog see the [changelog.txt](https://git.robotstxt.es/ROBOTSTXT/robotstxt-2fa/raw/branch/main/changelog.txt) file. +For the full changelog see the [changelog](https://www.robotstxt.software/plugins/robotstxt-2fa/) page. == Compliance == diff --git a/robotstxt-2fa.php b/robotstxt-2fa.php index fcc4e89..8bd4d4d 100644 --- a/robotstxt-2fa.php +++ b/robotstxt-2fa.php @@ -1,13 +1,15 @@ register(); - } - - /** - * Constructor. - * - * @param string $plugin_file_path Absolute path to the main plugin file. - */ - private function __construct( string $plugin_file_path ) { - $this->plugin_file_path = $plugin_file_path; - $this->plugin_basename = plugin_basename( $plugin_file_path ); - $this->plugin_slug = dirname( $this->plugin_basename ); - $this->plugin_data = $this->get_plugin_data(); - $this->json_url = $this->build_json_url(); - $this->cache_key = 'robotstxt_updater_' . md5( $this->plugin_basename ); - } - - /** - * Register WordPress hooks. - */ - private function register(): void { - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'inject_update_info' ) ); - add_filter( 'plugins_api', array( $this, 'provide_plugin_details' ), 10, 3 ); - add_action( 'admin_init', array( $this, 'handle_cache_clear' ) ); - add_action( 'robotstxt_updater_clear_cache', array( $this, 'clear_cache' ) ); - } - - /** - * Get plugin headers. - * - * @return array Plugin data. - */ - private function get_plugin_data(): array { - if ( ! function_exists( 'get_plugin_data' ) ) { - require_once ABSPATH . 'wp-admin/includes/plugin.php'; - } - - return get_plugin_data( $this->plugin_file_path, false, false ); - } - - /** - * Build JSON URL from plugin headers. - * - * Tries to use "Gitea Plugin URI" header to construct the URL. - * Falls back to Plugin URI if Gitea URI is not available. - * - * @return string JSON URL. - */ - private function build_json_url(): string { - // Try Gitea Plugin URI (format: "OWNER/REPO" or full URL). - if ( ! empty( $this->plugin_data['Gitea Plugin URI'] ) ) { - $gitea_uri = $this->plugin_data['Gitea Plugin URI']; - - // If it's already a full URL, use it. - if ( str_starts_with( $gitea_uri, 'http' ) ) { - // Extract base URL and construct JSON path. - return rtrim( $gitea_uri, '/' ) . '/raw/branch/main/update.json'; - } - - // If it's in format "OWNER/REPO", construct full URL. - if ( preg_match( '#^[^/]+/[^/]+$#', $gitea_uri ) ) { - return "https://git.robotstxt.es/{$gitea_uri}/raw/branch/main/update.json"; - } - } - - // Fallback: try to extract from Plugin URI. - if ( ! empty( $this->plugin_data['PluginURI'] ) ) { - $plugin_uri = $this->plugin_data['PluginURI']; - if ( str_contains( $plugin_uri, 'git.robotstxt.es' ) ) { - return rtrim( $plugin_uri, '/' ) . '/raw/branch/main/update.json'; - } - } - - // Last resort: construct from plugin slug. - return "https://git.robotstxt.es/ROBOTSTXT/{$this->plugin_slug}/raw/branch/main/update.json"; - } - - /** - * Inject update info into WP's plugin update transient. - * - * @param object|mixed $transient The update_plugins transient. - * - * @return object The modified transient. - */ - public function inject_update_info( $transient ) { - if ( ! is_object( $transient ) ) { - $transient = new stdClass(); - } - - if ( empty( $transient->checked ) || ! is_array( $transient->checked ) ) { - return $transient; - } - - if ( empty( $transient->checked[ $this->plugin_basename ] ) ) { - return $transient; - } - - $current_version = $transient->checked[ $this->plugin_basename ]; - $remote = $this->get_remote_data(); - - if ( empty( $remote['version'] ) || empty( $remote['download_url'] ) ) { - return $transient; - } - - if ( ! $this->is_compatible( $remote ) ) { - return $transient; - } - - if ( version_compare( $remote['version'], $current_version, '>' ) ) { - $update = (object) array( - 'slug' => $remote['slug'] ?? $this->plugin_slug, - 'plugin' => $this->plugin_basename, - 'new_version' => $remote['version'], - 'url' => $remote['homepage'] ?? $this->plugin_data['PluginURI'] ?? '', - 'package' => $remote['download_url'], - 'tested' => $remote['tested'] ?? '', - 'requires' => $remote['requires'] ?? '', - 'requires_php' => $remote['requires_php'] ?? '', - ); - - $transient->response[ $this->plugin_basename ] = $update; - } - - return $transient; - } - - /** - * Provide "View details" modal content. - * - * @param false|object|array $result The result object or array. - * @param string $action The type of information being requested. - * @param object $args Plugin API arguments. - * - * @return false|object The plugin information object or false. - */ - public function provide_plugin_details( $result, string $action, object $args ) { - if ( 'plugin_information' !== $action ) { - return $result; - } - - if ( empty( $args->slug ) || $args->slug !== $this->plugin_slug ) { - return $result; - } - - $remote = $this->get_remote_data(); - - if ( empty( $remote['version'] ) ) { - return $result; - } - - return (object) array( - 'name' => $remote['name'] ?? $this->plugin_data['Name'] ?? $this->plugin_slug, - 'slug' => $remote['slug'] ?? $this->plugin_slug, - 'version' => $remote['version'], - 'author' => $remote['author'] ?? $this->plugin_data['Author'] ?? '', - 'homepage' => $remote['homepage'] ?? $this->plugin_data['PluginURI'] ?? '', - 'requires' => $remote['requires'] ?? '', - 'tested' => $remote['tested'] ?? '', - 'requires_php' => $remote['requires_php'] ?? '', - 'sections' => array( - 'description' => $remote['description'] ?? $this->plugin_data['Description'] ?? '', - 'changelog' => $remote['changelog'] ?? '', - ), - 'download_link' => $remote['download_url'] ?? '', - ); - } - - /** - * Get remote data with caching and HMAC signature verification. - * - * @return array Remote data. - */ - private function get_remote_data(): array { - $cached = get_site_transient( $this->cache_key ); - - // Verify HMAC signature if AUTH_SALT is defined and cache has signature. - if ( false !== $cached && defined( 'AUTH_SALT' ) && '' !== AUTH_SALT ) { - if ( is_array( $cached ) && isset( $cached['signature'], $cached['data'] ) ) { - $expected_sig = hash_hmac( 'sha256', $this->cache_key . serialize( $cached['data'] ), AUTH_SALT ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize -- Used for HMAC signing, not for unserializing untrusted data. - - if ( hash_equals( $expected_sig, $cached['signature'] ) ) { - // Signature valid, return data. - return is_array( $cached['data'] ) ? $cached['data'] : array(); - } - - // Signature invalid, delete corrupted cache. - delete_site_transient( $this->cache_key ); - $cached = false; - } - } - - // If no valid cache, fetch fresh data. - if ( false === $cached ) { - $remote = $this->fetch_json(); - - // Store with HMAC signature if AUTH_SALT is available. - if ( defined( 'AUTH_SALT' ) && '' !== AUTH_SALT ) { - $remote_data = is_array( $remote ) ? $remote : array(); - $payload = array( - 'data' => $remote_data, - 'timestamp' => time(), - 'signature' => hash_hmac( 'sha256', $this->cache_key . serialize( $remote_data ), AUTH_SALT ), // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize -- Used for HMAC signing, not for unserializing untrusted data. - ); - set_site_transient( $this->cache_key, $payload, 6 * HOUR_IN_SECONDS ); - } else { - // Fallback to standard caching. - set_site_transient( $this->cache_key, is_array( $remote ) ? $remote : array(), 6 * HOUR_IN_SECONDS ); - } - - return is_array( $remote ) ? $remote : array(); - } - - // Legacy cache format without signature (backward compatibility). - return is_array( $cached ) ? $cached : array(); - } - - /** - * Fetch JSON from remote URL. - * - * @return array Decoded JSON data. - */ - private function fetch_json(): array { - $response = wp_remote_get( - $this->json_url, - array( - 'timeout' => 10, - 'headers' => array( - 'Accept' => 'application/json', - ), - ) - ); - - if ( is_wp_error( $response ) ) { - return array(); - } - - $code = (int) wp_remote_retrieve_response_code( $response ); - if ( $code < 200 || $code >= 300 ) { - return array(); - } - - $body = wp_remote_retrieve_body( $response ); - $data = json_decode( $body, true ); - - return is_array( $data ) ? $data : array(); - } - - /** - * Check compatibility. - * - * @param array $remote Remote data. - * - * @return bool True if compatible. - */ - private function is_compatible( array $remote ): bool { - if ( ! empty( $remote['requires_php'] ) ) { - if ( version_compare( PHP_VERSION, $remote['requires_php'], '<' ) ) { - return false; - } - } - - if ( ! empty( $remote['requires'] ) ) { - if ( version_compare( get_bloginfo( 'version' ), $remote['requires'], '<' ) ) { - return false; - } - } - - return true; - } - - /** - * Handle manual cache clear via URL parameter. - */ - public function handle_cache_clear(): void { - // Check if this is a cache clear request first. - $clear_cache = filter_input( INPUT_GET, 'robotstxt_clear_update_cache', FILTER_UNSAFE_RAW ); - if ( null === $clear_cache ) { - return; - } - - // This is a cache clear request - now verify nonce. - $nonce_raw = filter_input( INPUT_GET, '_wpnonce', FILTER_UNSAFE_RAW ); - $nonce = $nonce_raw ? sanitize_text_field( wp_unslash( $nonce_raw ) ) : ''; - - if ( ! wp_verify_nonce( $nonce, 'robotstxt_clear_update_cache' ) ) { - wp_die( esc_html__( 'Security check failed', 'robotstxt-2fa' ) ); - } - - // Check permissions. - if ( ! current_user_can( 'update_plugins' ) ) { - wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'robotstxt-2fa' ) ); - } - - $this->clear_cache(); - wp_safe_redirect( remove_query_arg( array( 'robotstxt_clear_update_cache', '_wpnonce' ) ) ); - exit; - } - - /** - * Clear update cache. - */ - public function clear_cache(): void { - delete_site_transient( $this->cache_key ); - delete_site_transient( 'update_plugins' ); - } - } -} diff --git a/update.json b/update.json index e46dbb3..7543046 100644 --- a/update.json +++ b/update.json @@ -1,8 +1,8 @@ { "name": "2FA (by ROBOTSTXT)", "slug": "robotstxt-2fa", - "version": "1.6.1", - "download_url": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-2fa/releases/download/1.6.1/robotstxt-2fa-1.6.1.zip", + "version": "1.6.2", + "download_url": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-2fa/releases/download/1.6.2/robotstxt-2fa-1.6.2.zip", "requires": "6.4", "requires_php": "8.0", "tested": "7.1", @@ -11,10 +11,10 @@ "author_profile": "https://www.robotstxt.es/", "homepage": "https://www.robotstxt.es/plugins/robotstxt-2fa/", "description": "Adds per-role two-factor authentication to the WordPress login flow. Supports email codes, authenticator apps (TOTP), and recovery codes.", - "changelog": "

1.6.1 - 2026-08-14

  • Fixed: Fatal error during editor autosaves — the [robotstxt_2fa_profile] shortcode expanded when WordPress applied content filters to a post revision via REST (e.g. an article that merely mentions the shortcode). The shortcode now bails out early on REST requests and loads the required wp-admin includes on demand elsewhere.
", + "changelog": "", "sections": { "description": "Adds per-role two-factor authentication to the WordPress login flow. Supports email codes, authenticator apps (TOTP), and recovery codes.", - "changelog": "

1.6.1 - 2026-08-14

  • Fixed: Fatal error during editor autosaves — the [robotstxt_2fa_profile] shortcode expanded when WordPress applied content filters to a post revision via REST (e.g. an article that merely mentions the shortcode). The shortcode now bails out early on REST requests and loads the required wp-admin includes on demand elsewhere.
" + "changelog": "" }, "banners": { "low": "", "high": "" }, "icons": { "1x": "", "2x": "" } diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 8955884..90d8705 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -22,8 +22,6 @@ class ComposerAutoloaderInit3c8f2c10a8655d88b9115205b533c7e2 return self::$loader; } - require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInit3c8f2c10a8655d88b9115205b533c7e2', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); spl_autoload_unregister(array('ComposerAutoloaderInit3c8f2c10a8655d88b9115205b533c7e2', 'loadClassLoader')); diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php deleted file mode 100644 index 14bf88d..0000000 --- a/vendor/composer/platform_check.php +++ /dev/null @@ -1,25 +0,0 @@ -= 80200)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 8.2.0". You are running ' . PHP_VERSION . '.'; -} - -if ($issues) { - if (!headers_sent()) { - header('HTTP/1.1 500 Internal Server Error'); - } - if (!ini_get('display_errors')) { - if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { - fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); - } elseif (!headers_sent()) { - echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; - } - } - throw new \RuntimeException( - 'Composer detected issues in your platform: ' . implode(' ', $issues) - ); -} From 511d2fefae0d8d1504245b3ffe78fc690db07dbe Mon Sep 17 00:00:00 2001 From: Javier Casares Date: Mon, 24 Aug 2026 08:18:14 +0000 Subject: [PATCH 02/10] v1.6.3 --- changelog.txt | 24 +++++++++++++ includes/admin/class-manager-notice.php | 30 +++++++++++----- includes/login/class-login-form-manager.php | 40 +++++++++++++++++++++ readme.txt | 29 +++++++-------- robotstxt-2fa.php | 4 +-- update.json | 22 ------------ vendor/composer/installed.php | 4 +-- 7 files changed, 103 insertions(+), 50 deletions(-) delete mode 100644 update.json diff --git a/changelog.txt b/changelog.txt index 5ba5490..5904ac3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,29 @@ == Changelog == += 1.6.3 = + +_Release date: 2026-08-24_ + +**Changed** + +* Manager detection now uses the ecosystem presence constant (`ROBOTSTXT_MANAGER_NOTICED`, defined by Manager 1.6.2+) with a fallback to the plugin-list scan for older Manager versions, so a stale plugin list can no longer produce false "Manager missing" notices. + +**Fixed** + +* Compatibility with the ALTCHA Spam Protection plugin: when "Protect login" was enabled, submitting the 2FA verification code failed with "[ALTCHA] Sorry, your request could not be processed.". The ALTCHA interceptor is now disabled while the verification screen is shown; the first login step keeps its ALTCHA check. + +**Compatibility** + +* WordPress: 5.6 – 7.1 +* PHP: 8.0 – 8.5 + +**Tests** + +* PHP Coding Standards: PHP_CodeSniffer 3.13.6 / WPCS 3.4.1 — 0 errors +* PHPStan: level 9 — 0 errors +* PHPCompatibility: 8.0–8.5 — 0 issues +* PHPUnit: 9.6.36 — 73 tests, 163 assertions + = 1.6.2 = _Release date: 2026-08-17_ diff --git a/includes/admin/class-manager-notice.php b/includes/admin/class-manager-notice.php index 567a166..7fb1e2d 100644 --- a/includes/admin/class-manager-notice.php +++ b/includes/admin/class-manager-notice.php @@ -20,11 +20,6 @@ if ( ! defined( 'ABSPATH' ) ) { */ class Manager_Notice { - /** - * Basename of the Manager plugin main file. - */ - private const MANAGER_BASENAME = 'robotstxt-manager/robotstxt-manager.php'; - /** * URL of the Manager plugin page. */ @@ -56,16 +51,35 @@ class Manager_Notice { /** * Whether the Manager (by ROBOTSTXT) plugin is active. * + * Uses the ecosystem presence constant (Manager 1.6.2+) and falls back + * to a plugin-list scan for older Manager versions. + * * @since 1.6.2 * - * @return bool True when the manager plugin is active. + * @return bool True when the Manager plugin is present and activated. */ public static function is_manager_active(): bool { - if ( ! function_exists( 'is_plugin_active' ) ) { + if ( defined( 'ROBOTSTXT_MANAGER_NOTICED' ) && ROBOTSTXT_MANAGER_NOTICED ) { + return true; + } + + if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } - return is_plugin_active( self::MANAGER_BASENAME ); + foreach ( get_plugins() as $file => $data ) { + $slug = dirname( $file ); + + if ( '.' === $slug ) { + $slug = basename( $file, '.php' ); + } + + if ( 'robotstxt-manager' === $slug ) { + return is_plugin_active( $file ); + } + } + + return false; } /** diff --git a/includes/login/class-login-form-manager.php b/includes/login/class-login-form-manager.php index a859a0a..8150351 100644 --- a/includes/login/class-login-form-manager.php +++ b/includes/login/class-login-form-manager.php @@ -233,6 +233,46 @@ class Login_Form_Manager { add_filter( 'login_message', array( $this, 'filter_login_message' ) ); add_filter( 'authenticate', array( $this, 'maybe_complete_verification' ), 5, 3 ); add_filter( 'authenticate', array( $this, 'enforce_verification_challenge' ), 30, 3 ); + add_action( 'init', array( $this, 'maybe_remove_altcha_interceptor' ), 0 ); + } + + /** + * Disable the ALTCHA Spam Protection login interceptor during the 2FA stage. + * + * ALTCHA's "Protect login" feature rejects any wp-login.php POST that does + * not carry a fresh proof-of-work payload (HTTP 403). Its JavaScript only + * produces that payload for classic username + password submissions, while + * the verification stage intentionally omits the password field, so every + * legitimate 2FA submission would otherwise be blocked. Human verification + * already happened on the first login step; this stage is protected by the + * pending-stage token, the stage nonce, and the failed-attempts lockout. + * + * @since 1.6.2 + * + * @return void + */ + public function maybe_remove_altcha_interceptor(): void { + if ( ! $this->is_verification_stage() ) { + return; + } + + if ( ! has_action( 'init', 'altcha_interceptor' ) ) { + return; + } + + global $wp_filter; + + if ( ! isset( $wp_filter['init'] ) || ! $wp_filter['init'] instanceof \WP_Hook ) { + return; + } + + foreach ( array_keys( $wp_filter['init']->callbacks ) as $priority ) { + if ( isset( $wp_filter['init']->callbacks[ $priority ]['altcha_interceptor'] ) ) { + remove_action( 'init', 'altcha_interceptor', (int) $priority ); + + return; + } + } } /** diff --git a/readme.txt b/readme.txt index fbbe77f..f5d342c 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: security, two-factor authentication, login, otp Requires at least: 5.6 Tested up to: 7.0 Requires PHP: 8.0 -Stable tag: 1.6.2 +Stable tag: 1.6.3 License: GPLv3 or later License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -59,6 +59,18 @@ Yes. Activate the plugin at the network level. Network administrators can set an == Changelog == += 1.6.3 = + +_Release date: 2026-08-24_ + +**Changed** + +* Manager detection now uses the ecosystem presence constant (`ROBOTSTXT_MANAGER_NOTICED`, defined by Manager 1.6.2+) with a fallback to the plugin-list scan for older Manager versions. + +**Fixed** + +* Compatibility with the ALTCHA Spam Protection plugin: when "Protect login" was enabled, submitting the 2FA verification code failed with "[ALTCHA] Sorry, your request could not be processed.". The ALTCHA interceptor is now disabled while the verification screen is shown; the first login step keeps its ALTCHA check. + = 1.6.2 = _Release date: 2026-08-17_ @@ -81,21 +93,6 @@ _Release date: 2026-08-14_ * Fatal error during editor autosaves: the `[robotstxt_2fa_profile]` shortcode expanded when WordPress applied content filters to a post revision via REST (for example, an article that merely mentions the shortcode in its text). In that context the wp-admin render helpers are not loaded, causing a fatal error. The shortcode now bails out early on REST requests and loads the required wp-admin includes on demand elsewhere. -= 1.6.0 = - -_Release date: 2026-08-07_ - -**Added** - -* REST API for administrators (namespace `robotstxt-2fa/v1`, all endpoints require `manage_options`): - * `GET /wp-json/robotstxt-2fa/v1/settings` — read the full 2FA configuration. - * `PUT /wp-json/robotstxt-2fa/v1/settings` — update the configuration (reuses the same validation as the admin settings form). - * `GET /wp-json/robotstxt-2fa/v1/users?role=&status=` — list every user with their 2FA status: enabled, configured methods, role-required methods, forced flag, frequency, preferred method, whether OTP is set up, and unused recovery code count. No secrets are exposed. - -**Changed** - -* `wp 2fa list` now shows separate **Enabled**, **Methods** (configured), and **Required** (role-enforced) columns, plus a new `--required` filter to list only users whose role enforces 2FA. - = Previous versions = For the full changelog see the [changelog](https://www.robotstxt.software/plugins/robotstxt-2fa/) page. diff --git a/robotstxt-2fa.php b/robotstxt-2fa.php index 8bd4d4d..cb23599 100644 --- a/robotstxt-2fa.php +++ b/robotstxt-2fa.php @@ -4,7 +4,7 @@ * Plugin URI: https://www.robotstxt.software/plugins/robotstxt-2fa/ * Update URI: https://www.robotstxt.software/plugins/robotstxt-2fa/ * Description: Adds two-factor authentication to the WordPress login flow. - * Version: 1.6.2 + * Version: 1.6.3 * Author: ROBOTSTXT * Author URI: https://www.robotstxt.software/ * Text Domain: robotstxt-2fa @@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) { } if ( ! defined( 'ROBOTSTXT_2FA_VERSION' ) ) { - define( 'ROBOTSTXT_2FA_VERSION', '1.6.2' ); + define( 'ROBOTSTXT_2FA_VERSION', '1.6.3' ); } if ( ! defined( 'ROBOTSTXT_2FA_FILE' ) ) { diff --git a/update.json b/update.json deleted file mode 100644 index 7543046..0000000 --- a/update.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "2FA (by ROBOTSTXT)", - "slug": "robotstxt-2fa", - "version": "1.6.2", - "download_url": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-2fa/releases/download/1.6.2/robotstxt-2fa-1.6.2.zip", - "requires": "6.4", - "requires_php": "8.0", - "tested": "7.1", - "last_updated": "2026-08-14", - "author": "ROBOTSTXT", - "author_profile": "https://www.robotstxt.es/", - "homepage": "https://www.robotstxt.es/plugins/robotstxt-2fa/", - "description": "Adds per-role two-factor authentication to the WordPress login flow. Supports email codes, authenticator apps (TOTP), and recovery codes.", - "changelog": "", - "sections": { - "description": "Adds per-role two-factor authentication to the WordPress login flow. Supports email codes, authenticator apps (TOTP), and recovery codes.", - "changelog": "" - }, - "banners": { "low": "", "high": "" }, - "icons": { "1x": "", "2x": "" } -} - diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index e9b72d6..144e152 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'robotstxt/robotstxt-2fa', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '6ee18abad9ca997d00a8f2397aee3cc77a90a4e3', + 'reference' => '2f5ed132e25529d95b04f81bfd33dfdbcb0fc487', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -40,7 +40,7 @@ 'robotstxt/robotstxt-2fa' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '6ee18abad9ca997d00a8f2397aee3cc77a90a4e3', + 'reference' => '2f5ed132e25529d95b04f81bfd33dfdbcb0fc487', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), From e568b54336bb1cf79f69b4f265d2e080e50ae64a Mon Sep 17 00:00:00 2001 From: Javier Casares Date: Fri, 11 Sep 2026 10:29:29 +0000 Subject: [PATCH 03/10] v1.6.4 --- changelog.txt | 20 +++++++++++++ includes/login/class-login-form-manager.php | 31 +++++++++++++++++++-- readme.txt | 18 ++++++------ robotstxt-2fa.php | 4 +-- vendor/composer/installed.php | 4 +-- 5 files changed, 62 insertions(+), 15 deletions(-) diff --git a/changelog.txt b/changelog.txt index 5904ac3..19aae42 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,25 @@ == Changelog == += 1.6.4 = + +_Release date: 2026-09-11_ + +**Fixed** + +* Compatibility with Restrict Content Pro's "Hijack Login URL" option: RCP's `login_url` filter made every `wp_login_url()` call return a membership page, so the 2FA verification redirect landed on a restricted page where the verification form cannot render, and the visitor was bounced to the registration page. Verification-stage URLs are now built from the canonical `wp-login.php`, mirroring WordPress core's URL construction before the filterable output. The "Back to login" link keeps the site-configured login URL. + +**Compatibility** + +* WordPress: 5.6 – 7.1 +* PHP: 8.0 – 8.5 + +**Tests** + +* PHP Coding Standards: PHP_CodeSniffer 3.13.6 / WPCS 3.4.1 — 0 errors +* PHPStan: level 9 — 0 errors +* PHPCompatibility: 8.0–8.5 — 0 issues +* PHPUnit: 9.6.36 — 78 tests, 171 assertions + = 1.6.3 = _Release date: 2026-08-24_ diff --git a/includes/login/class-login-form-manager.php b/includes/login/class-login-form-manager.php index 8150351..fb10f05 100644 --- a/includes/login/class-login-form-manager.php +++ b/includes/login/class-login-form-manager.php @@ -236,6 +236,33 @@ class Login_Form_Manager { add_action( 'init', array( $this, 'maybe_remove_altcha_interceptor' ), 0 ); } + /** + * Retrieve the canonical wp-login.php URL used for 2FA stage navigation. + * + * Builds the URL from the real wp-login.php path instead of wp_login_url(). + * The `login_url` filter applied by wp_login_url() can be hijacked by + * third-party plugins (for example Restrict Content Pro's "Hijack Login + * URL" option) to return a membership page, which would send the user to a + * page where the verification form cannot render: core only fires the + * login_init hook when wp-login.php itself loads. This mirrors the URL + * construction wp_login_url() performs before its filter runs. + * + * @since 1.6.4 + * + * @param string $redirect_to Optional redirect_to value to carry over. + * + * @return string Absolute wp-login.php URL with optional redirect_to parameter. + */ + public static function get_canonical_login_url( string $redirect_to = '' ): string { + $url = site_url( 'wp-login.php', 'login' ); + + if ( '' !== $redirect_to ) { + $url = add_query_arg( 'redirect_to', urlencode( $redirect_to ), $url ); + } + + return $url; + } + /** * Disable the ALTCHA Spam Protection login interceptor during the 2FA stage. * @@ -863,7 +890,7 @@ class Login_Form_Manager { self::QUERY_STAGE_TOKEN => $stage_token, ); - $login_url = wp_login_url( $redirect_to ); + $login_url = self::get_canonical_login_url( $redirect_to ); $login_url = add_query_arg( $query_args, $login_url ); wp_safe_redirect( $login_url ); @@ -1433,7 +1460,7 @@ class Login_Form_Manager { */ private function get_stage_url( array $extra_args = array() ): string { $redirect_to = $this->get_requested_redirect(); - $login_url = wp_login_url( $redirect_to ); + $login_url = self::get_canonical_login_url( $redirect_to ); $args = array( self::QUERY_STAGE => self::STAGE_VERIFY, diff --git a/readme.txt b/readme.txt index f5d342c..b214d6b 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: security, two-factor authentication, login, otp Requires at least: 5.6 Tested up to: 7.0 Requires PHP: 8.0 -Stable tag: 1.6.3 +Stable tag: 1.6.4 License: GPLv3 or later License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -59,6 +59,14 @@ Yes. Activate the plugin at the network level. Network administrators can set an == Changelog == += 1.6.4 = + +_Release date: 2026-09-11_ + +**Fixed** + +* Compatibility with Restrict Content Pro's "Hijack Login URL" option: RCP's `login_url` filter made every `wp_login_url()` call return a membership page, so the 2FA verification redirect landed on a restricted page where the verification form cannot render, and the visitor was bounced to the registration page. Verification-stage URLs are now built from the canonical `wp-login.php`, mirroring WordPress core's URL construction before the filterable output. The "Back to login" link keeps the site-configured login URL. + = 1.6.3 = _Release date: 2026-08-24_ @@ -85,14 +93,6 @@ _Release date: 2026-08-17_ * Plugin and update URLs moved to `robotstxt.software`. * Minimum WordPress version lowered from 6.4 to 5.6 after a full compatibility review (the code only requires WordPress 5.3+ functions, and WordPress 5.6 is the first release that runs on the required PHP 8.0). -= 1.6.1 = - -_Release date: 2026-08-14_ - -**Fixed** - -* Fatal error during editor autosaves: the `[robotstxt_2fa_profile]` shortcode expanded when WordPress applied content filters to a post revision via REST (for example, an article that merely mentions the shortcode in its text). In that context the wp-admin render helpers are not loaded, causing a fatal error. The shortcode now bails out early on REST requests and loads the required wp-admin includes on demand elsewhere. - = Previous versions = For the full changelog see the [changelog](https://www.robotstxt.software/plugins/robotstxt-2fa/) page. diff --git a/robotstxt-2fa.php b/robotstxt-2fa.php index cb23599..36847c7 100644 --- a/robotstxt-2fa.php +++ b/robotstxt-2fa.php @@ -4,7 +4,7 @@ * Plugin URI: https://www.robotstxt.software/plugins/robotstxt-2fa/ * Update URI: https://www.robotstxt.software/plugins/robotstxt-2fa/ * Description: Adds two-factor authentication to the WordPress login flow. - * Version: 1.6.3 + * Version: 1.6.4 * Author: ROBOTSTXT * Author URI: https://www.robotstxt.software/ * Text Domain: robotstxt-2fa @@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) { } if ( ! defined( 'ROBOTSTXT_2FA_VERSION' ) ) { - define( 'ROBOTSTXT_2FA_VERSION', '1.6.3' ); + define( 'ROBOTSTXT_2FA_VERSION', '1.6.4' ); } if ( ! defined( 'ROBOTSTXT_2FA_FILE' ) ) { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 144e152..e32404a 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'robotstxt/robotstxt-2fa', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '2f5ed132e25529d95b04f81bfd33dfdbcb0fc487', + 'reference' => '54a0dd9b62465320c6e7045c568aa258925b208e', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -40,7 +40,7 @@ 'robotstxt/robotstxt-2fa' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '2f5ed132e25529d95b04f81bfd33dfdbcb0fc487', + 'reference' => '54a0dd9b62465320c6e7045c568aa258925b208e', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), From c72a96e2a043a17a9d756671e96c97a5734a24ed Mon Sep 17 00:00:00 2001 From: Javier Casares Date: Thu, 17 Sep 2026 10:57:29 +0000 Subject: [PATCH 04/10] v1.6.5 --- changelog.txt | 21 ++++++++++++ includes/class-geo-restrictions.php | 8 ++--- includes/class-ip-restrictions.php | 8 ++--- includes/login/class-login-form-manager.php | 37 ++++++++++++--------- includes/user/class-profile-settings.php | 8 +++-- readme.txt | 25 ++++++-------- robotstxt-2fa.php | 4 +-- vendor/composer/installed.php | 4 +-- 8 files changed, 69 insertions(+), 46 deletions(-) diff --git a/changelog.txt b/changelog.txt index 19aae42..1e0e2bf 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,26 @@ == Changelog == += 1.6.5 = + +_Release date: 2026-09-17_ + +**Fixed** + +* Fatal error on the login screen with newer WordPress versions: the `login_message` filter can deliver null when no message is set (observed on WordPress 7.x with PHP 8.4, TypeError on a plain visit to wp-login.php). The message callback now accepts `string|null` and coalesces null to an empty string. +* Hardened all externally-fed filter callbacks against null payloads: the four `authenticate` callbacks now accept `string|null` credentials (custom REST/SSO endpoints are known to apply the filter with null), and the `wp_redirect` filter callback coalesces a null location. Verified safe as-is: shortcode callback, Settings API sanitizer, activation hooks, and admin-hook parameters. + +**Compatibility** + +* WordPress: 5.6 – 7.1 +* PHP: 8.0 – 8.5 + +**Tests** + +* PHP Coding Standards: PHP_CodeSniffer 3.13.6 / WPCS 3.4.1 — 0 errors +* PHPStan: level 9 — 0 errors +* PHPCompatibility: 8.0–8.5 — 0 issues +* PHPUnit: 9.6.36 — 87 tests, 180 assertions + = 1.6.4 = _Release date: 2026-09-11_ diff --git a/includes/class-geo-restrictions.php b/includes/class-geo-restrictions.php index e6a10dc..7ce090e 100644 --- a/includes/class-geo-restrictions.php +++ b/includes/class-geo-restrictions.php @@ -85,13 +85,13 @@ class Geo_Restrictions { * * @since 1.5.0 * - * @param mixed $user Previously authenticated user or null. - * @param string $username Submitted username. - * @param string $password Submitted password. + * @param mixed $user Previously authenticated user or null. + * @param string|null $username Submitted username. + * @param string|null $password Submitted password. * * @return mixed */ - public function maybe_block_denied_country( mixed $user, string $username, string $password ): mixed { + public function maybe_block_denied_country( mixed $user, ?string $username, ?string $password ): mixed { unset( $username, $password ); $deny_list = $this->config->get_geoip_country_deny(); diff --git a/includes/class-ip-restrictions.php b/includes/class-ip-restrictions.php index 91b5c5e..1d28c19 100644 --- a/includes/class-ip-restrictions.php +++ b/includes/class-ip-restrictions.php @@ -82,13 +82,13 @@ class IP_Restrictions { * * @since 1.3.0 * - * @param mixed $user Previously authenticated user or error. - * @param string $username Submitted username. - * @param string $password Submitted password. + * @param mixed $user Previously authenticated user or error. + * @param string|null $username Submitted username. + * @param string|null $password Submitted password. * * @return mixed */ - public function maybe_block_denied_ip( mixed $user, string $username, string $password ): mixed { + public function maybe_block_denied_ip( mixed $user, ?string $username, ?string $password ): mixed { unset( $username, $password ); $deny_list = $this->config->get_ip_deny(); diff --git a/includes/login/class-login-form-manager.php b/includes/login/class-login-form-manager.php index fb10f05..3f00773 100644 --- a/includes/login/class-login-form-manager.php +++ b/includes/login/class-login-form-manager.php @@ -463,16 +463,21 @@ class Login_Form_Manager { is_verification_stage() ) { return $message; } @@ -619,12 +624,12 @@ class Login_Form_Manager { * Attempt to finish the verification stage during authentication. * * @param \WP_User|\WP_Error|null $user Previously authenticated user or error. - * @param string $username Submitted username. - * @param string $password Submitted password. + * @param string|null $username Submitted username. + * @param string|null $password Submitted password. * * @return \WP_User|\WP_Error|null */ - public function maybe_complete_verification( $user, string $username, string $password ) { + public function maybe_complete_verification( $user, ?string $username, ?string $password ) { if ( ! $this->is_verification_submission() ) { return $user; } @@ -785,12 +790,12 @@ class Login_Form_Manager { * Enforce the verification step for eligible users. * * @param \WP_User|\WP_Error|null $user Previously authenticated user or error. - * @param string $username Submitted username. - * @param string $password Submitted password. + * @param string|null $username Submitted username. + * @param string|null $password Submitted password. * * @return \WP_User|\WP_Error|null */ - public function enforce_verification_challenge( $user, string $username, string $password ) { + public function enforce_verification_challenge( $user, ?string $username, ?string $password ) { unset( $username, $password ); if ( $this->is_verification_stage() || $this->is_verification_submission() ) { diff --git a/includes/user/class-profile-settings.php b/includes/user/class-profile-settings.php index 6e7751d..ff2ceb8 100644 --- a/includes/user/class-profile-settings.php +++ b/includes/user/class-profile-settings.php @@ -1113,14 +1113,16 @@ class Profile_Settings { /** * Append the 2FA section anchor to redirects when requested. * - * @param string $location Redirect destination. - * @param int $status HTTP status code. + * @param string|null $location Redirect destination (null from sloppy wp_redirect() callers). + * @param int|null $status HTTP status code. * * @return string */ - public function maybe_append_section_anchor( string $location, int $status ): string { + public function maybe_append_section_anchor( ?string $location, ?int $status = null ): string { unset( $status ); + $location = $location ?? ''; + if ( ! $this->focus_section ) { return $location; } diff --git a/readme.txt b/readme.txt index b214d6b..9526647 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: security, two-factor authentication, login, otp Requires at least: 5.6 Tested up to: 7.0 Requires PHP: 8.0 -Stable tag: 1.6.4 +Stable tag: 1.6.5 License: GPLv3 or later License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -59,6 +59,15 @@ Yes. Activate the plugin at the network level. Network administrators can set an == Changelog == += 1.6.5 = + +_Release date: 2026-09-17_ + +**Fixed** + +* Fatal error on the login screen with newer WordPress versions: the `login_message` filter can deliver null when no message is set (observed on WordPress 7.x with PHP 8.4, TypeError on a plain visit to wp-login.php). The message callback now accepts `string|null` and coalesces null to an empty string. +* Hardened all externally-fed filter callbacks against null payloads: the four `authenticate` callbacks now accept `string|null` credentials (custom REST/SSO endpoints are known to apply the filter with null), and the `wp_redirect` filter callback coalesces a null location. + = 1.6.4 = _Release date: 2026-09-11_ @@ -79,20 +88,6 @@ _Release date: 2026-08-24_ * Compatibility with the ALTCHA Spam Protection plugin: when "Protect login" was enabled, submitting the 2FA verification code failed with "[ALTCHA] Sorry, your request could not be processed.". The ALTCHA interceptor is now disabled while the verification screen is shown; the first login step keeps its ALTCHA check. -= 1.6.2 = - -_Release date: 2026-08-17_ - -**Added** - -* Recommendation notice for the Manager (by ROBOTSTXT) plugin: when it is not installed and active, a dismissible notice appears on the Plugins screen and a permanent notice is shown on the plugin settings page, since updates are delivered through the Manager plugin. - -**Changed** - -* Updates are now handled by the Manager (by ROBOTSTXT) plugin. The bundled self-updater (`robotstxt-updater.php` and `update.json`) has been removed. -* Plugin and update URLs moved to `robotstxt.software`. -* Minimum WordPress version lowered from 6.4 to 5.6 after a full compatibility review (the code only requires WordPress 5.3+ functions, and WordPress 5.6 is the first release that runs on the required PHP 8.0). - = Previous versions = For the full changelog see the [changelog](https://www.robotstxt.software/plugins/robotstxt-2fa/) page. diff --git a/robotstxt-2fa.php b/robotstxt-2fa.php index 36847c7..3c1d9a4 100644 --- a/robotstxt-2fa.php +++ b/robotstxt-2fa.php @@ -4,7 +4,7 @@ * Plugin URI: https://www.robotstxt.software/plugins/robotstxt-2fa/ * Update URI: https://www.robotstxt.software/plugins/robotstxt-2fa/ * Description: Adds two-factor authentication to the WordPress login flow. - * Version: 1.6.4 + * Version: 1.6.5 * Author: ROBOTSTXT * Author URI: https://www.robotstxt.software/ * Text Domain: robotstxt-2fa @@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) { } if ( ! defined( 'ROBOTSTXT_2FA_VERSION' ) ) { - define( 'ROBOTSTXT_2FA_VERSION', '1.6.4' ); + define( 'ROBOTSTXT_2FA_VERSION', '1.6.5' ); } if ( ! defined( 'ROBOTSTXT_2FA_FILE' ) ) { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index e32404a..292a775 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'robotstxt/robotstxt-2fa', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '54a0dd9b62465320c6e7045c568aa258925b208e', + 'reference' => 'ed617610896f05f9dc90a3b0f53b19c9dacd59a5', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -40,7 +40,7 @@ 'robotstxt/robotstxt-2fa' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '54a0dd9b62465320c6e7045c568aa258925b208e', + 'reference' => 'ed617610896f05f9dc90a3b0f53b19c9dacd59a5', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), From f9c073a582ec5726350944d465b73174dc6582cf Mon Sep 17 00:00:00 2001 From: Javier Casares Date: Thu, 17 Sep 2026 10:58:22 +0000 Subject: [PATCH 05/10] v1.6.6 --- changelog.txt | 20 ++++++++ includes/user/class-profile-settings.php | 60 ++++++++++++++++++++++++ readme.txt | 22 ++++----- robotstxt-2fa.php | 4 +- vendor/composer/installed.php | 4 +- 5 files changed, 93 insertions(+), 17 deletions(-) diff --git a/changelog.txt b/changelog.txt index 1e0e2bf..0c678d8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,25 @@ == Changelog == += 1.6.6 = + +_Release date: 2026-09-17_ + +**Added** + +* Forced-enrollment warning on the profile 2FA section: when a user's role enforces 2FA but they have no verification method configured yet, the 2FA section of their profile (wp-admin and the frontend shortcode) opens with a warning notice asking them to activate at least one method. While a grace period is active, the notice appends the remaining days. + +**Compatibility** + +* WordPress: 5.6 – 7.1 +* PHP: 8.0 – 8.5 + +**Tests** + +* PHP Coding Standards: PHP_CodeSniffer 3.13.6 / WPCS 3.4.1 — 0 errors +* PHPStan: level 9 — 0 errors +* PHPCompatibility: 8.0–8.5 — 0 issues +* PHPUnit: 9.6.36 — 93 tests, 189 assertions + = 1.6.5 = _Release date: 2026-09-17_ diff --git a/includes/user/class-profile-settings.php b/includes/user/class-profile-settings.php index ff2ceb8..f136ca0 100644 --- a/includes/user/class-profile-settings.php +++ b/includes/user/class-profile-settings.php @@ -97,6 +97,13 @@ class Profile_Settings { */ private Trusted_Devices $trusted_devices; + /** + * Grace period manager. + * + * @var Grace_Period + */ + private Grace_Period $grace_period; + /** * Whether the post-save redirect should focus the 2FA section. * @@ -113,6 +120,7 @@ class Profile_Settings { $this->otp_manager = new OTP_Manager(); $this->recovery_codes = new Recovery_Codes(); $this->trusted_devices = new Trusted_Devices(); + $this->grace_period = new Grace_Period(); } /** @@ -170,6 +178,57 @@ class Profile_Settings { } + /** + * Render the forced-enrollment warning on the profile 2FA section. + * + * Shown when the user's role enforces 2FA but no verification method is + * configured yet, so the requirement is visible before the login flow + * (grace notice, setup wizard, or login block) kicks in. When a grace + * period is active, the number of remaining days is appended. + * + * @since 1.6.6 + * + * @param \WP_User $user User whose profile section is being rendered. + * + * @return void + */ + public function render_forced_enrollment_warning( \WP_User $user ): void { + $user_settings = $this->user_settings_repository->get_user_settings( $user->ID ); + + if ( empty( $this->config->get_required_methods_for_user( $user ) ) || ! empty( $user_settings['methods'] ) ) { + return; + } + + $grace_note = ''; + $grace_days = $this->config->get_grace_period_days(); + + if ( $grace_days > 0 && $this->grace_period->is_active( $user, $grace_days ) ) { + $remaining = $this->grace_period->get_days_remaining( $user, $grace_days ); + + /* translators: %d: number of days remaining to complete the setup. */ + $grace_note = sprintf( + _n( + 'You have %d day left to complete the setup.', + 'You have %d days left to complete the setup.', + $remaining, + 'robotstxt-2fa' + ), + $remaining + ); + } + ?> +
+

+ + + + + +

+
+

+ render_forced_enrollment_warning( $user ); ?> diff --git a/readme.txt b/readme.txt index 9526647..c42cca4 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: security, two-factor authentication, login, otp Requires at least: 5.6 Tested up to: 7.0 Requires PHP: 8.0 -Stable tag: 1.6.5 +Stable tag: 1.6.6 License: GPLv3 or later License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -59,6 +59,14 @@ Yes. Activate the plugin at the network level. Network administrators can set an == Changelog == += 1.6.6 = + +_Release date: 2026-09-17_ + +**Added** + +* Forced-enrollment warning on the profile 2FA section: when a user's role enforces 2FA but they have no verification method configured yet, the 2FA section of their profile (wp-admin and the frontend shortcode) opens with a warning notice asking them to activate at least one method. While a grace period is active, the notice appends the remaining days. + = 1.6.5 = _Release date: 2026-09-17_ @@ -76,18 +84,6 @@ _Release date: 2026-09-11_ * Compatibility with Restrict Content Pro's "Hijack Login URL" option: RCP's `login_url` filter made every `wp_login_url()` call return a membership page, so the 2FA verification redirect landed on a restricted page where the verification form cannot render, and the visitor was bounced to the registration page. Verification-stage URLs are now built from the canonical `wp-login.php`, mirroring WordPress core's URL construction before the filterable output. The "Back to login" link keeps the site-configured login URL. -= 1.6.3 = - -_Release date: 2026-08-24_ - -**Changed** - -* Manager detection now uses the ecosystem presence constant (`ROBOTSTXT_MANAGER_NOTICED`, defined by Manager 1.6.2+) with a fallback to the plugin-list scan for older Manager versions. - -**Fixed** - -* Compatibility with the ALTCHA Spam Protection plugin: when "Protect login" was enabled, submitting the 2FA verification code failed with "[ALTCHA] Sorry, your request could not be processed.". The ALTCHA interceptor is now disabled while the verification screen is shown; the first login step keeps its ALTCHA check. - = Previous versions = For the full changelog see the [changelog](https://www.robotstxt.software/plugins/robotstxt-2fa/) page. diff --git a/robotstxt-2fa.php b/robotstxt-2fa.php index 3c1d9a4..8ff56f1 100644 --- a/robotstxt-2fa.php +++ b/robotstxt-2fa.php @@ -4,7 +4,7 @@ * Plugin URI: https://www.robotstxt.software/plugins/robotstxt-2fa/ * Update URI: https://www.robotstxt.software/plugins/robotstxt-2fa/ * Description: Adds two-factor authentication to the WordPress login flow. - * Version: 1.6.5 + * Version: 1.6.6 * Author: ROBOTSTXT * Author URI: https://www.robotstxt.software/ * Text Domain: robotstxt-2fa @@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) { } if ( ! defined( 'ROBOTSTXT_2FA_VERSION' ) ) { - define( 'ROBOTSTXT_2FA_VERSION', '1.6.5' ); + define( 'ROBOTSTXT_2FA_VERSION', '1.6.6' ); } if ( ! defined( 'ROBOTSTXT_2FA_FILE' ) ) { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 292a775..7328496 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'robotstxt/robotstxt-2fa', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'ed617610896f05f9dc90a3b0f53b19c9dacd59a5', + 'reference' => 'f1d493aefc9da797d99b3b635736b6c627166ddf', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -40,7 +40,7 @@ 'robotstxt/robotstxt-2fa' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'ed617610896f05f9dc90a3b0f53b19c9dacd59a5', + 'reference' => 'f1d493aefc9da797d99b3b635736b6c627166ddf', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), From c3f0eac50c4ac57a2e8c7c105c1dd6d32081c187 Mon Sep 17 00:00:00 2001 From: Javier Casares Date: Fri, 18 Sep 2026 04:36:07 +0000 Subject: [PATCH 06/10] v1.6.7 --- changelog.txt | 20 +++++++++++++ includes/user/class-grace-period.php | 38 +++++++++++++++++++++++- includes/user/class-profile-settings.php | 14 +++++++++ readme.txt | 18 +++++------ robotstxt-2fa.php | 4 +-- vendor/composer/installed.php | 4 +-- 6 files changed, 84 insertions(+), 14 deletions(-) diff --git a/changelog.txt b/changelog.txt index 0c678d8..67c38b2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,25 @@ == Changelog == += 1.6.7 = + +_Release date: 2026-09-17_ + +**Fixed** + +* The forced-setup wizard felt like a broken redirect loop: the wizard redirect bounced users to the profile with no explanation (it now carries a flag that renders a clear "activate at least one verification method, then save" warning), and saving with an expired form nonce silently did nothing (it now raises a visible "form session expired" error so users know to try again). + +**Compatibility** + +* WordPress: 5.6 – 7.1 +* PHP: 8.0 – 8.5 + +**Tests** + +* PHP Coding Standards: PHP_CodeSniffer 3.13.6 / WPCS 3.4.1 — 0 errors +* PHPStan: level 9 — 0 errors +* PHPCompatibility: 8.0–8.5 — 0 issues +* PHPUnit: 9.6.36 — 98 tests, 197 assertions + = 1.6.6 = _Release date: 2026-09-17_ diff --git a/includes/user/class-grace-period.php b/includes/user/class-grace-period.php index b074a79..31399d6 100644 --- a/includes/user/class-grace-period.php +++ b/includes/user/class-grace-period.php @@ -41,6 +41,7 @@ class Grace_Period { public function register_hooks(): void { add_action( 'admin_init', array( $this, 'maybe_redirect_to_setup_wizard' ) ); add_action( 'robotstxt_2fa_method_enabled', array( $this, 'clear_pending_setup' ), 10, 2 ); + add_action( 'admin_notices', array( $this, 'maybe_show_setup_required_notice' ) ); } /** @@ -167,10 +168,45 @@ class Grace_Period { return; } - wp_safe_redirect( admin_url( 'profile.php#robotstxt-2fa-settings' ) ); + // The query flag lets the profile show WHY the user was redirected, + // so the mandatory setup does not feel like a silent loop. + $profile_url = add_query_arg( 'robotstxt-2fa-setup-required', '1', admin_url( 'profile.php' ) ); + + wp_safe_redirect( $profile_url . '#robotstxt-2fa-settings' ); exit; } + /** + * Explain the setup wizard redirect on the profile screen. + * + * Rendered after {@see self::maybe_redirect_to_setup_wizard()} bounced the + * user back to their profile. Without it, users land on a regular profile + * page with no hint that 2FA enrollment is mandatory before they can + * continue to the dashboard — which reads as a broken redirect loop. + * + * @since 1.6.7 + * + * @return void + */ + public function maybe_show_setup_required_notice(): void { + if ( ! $this->is_pending_setup() ) { + return; + } + + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Display-only flag; no state change. + if ( ! isset( $_GET['robotstxt-2fa-setup-required'] ) ) { + return; + } + ?> +
+

+ + +

+
+ focus_section = true; + add_settings_error( + 'robotstxt-2fa', + 'robotstxt-2fa-nonce-expired', + __( 'Your form session expired and nothing was saved. Please try saving again.', 'robotstxt-2fa' ), + 'error' + ); + return; } diff --git a/readme.txt b/readme.txt index c42cca4..fd801dc 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: security, two-factor authentication, login, otp Requires at least: 5.6 Tested up to: 7.0 Requires PHP: 8.0 -Stable tag: 1.6.6 +Stable tag: 1.6.7 License: GPLv3 or later License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -59,6 +59,14 @@ Yes. Activate the plugin at the network level. Network administrators can set an == Changelog == += 1.6.7 = + +_Release date: 2026-09-17_ + +**Fixed** + +* The forced-setup wizard felt like a broken redirect loop: the wizard redirect bounced users to the profile with no explanation (it now carries a flag that renders a clear "activate at least one verification method, then save" warning), and saving with an expired form nonce silently did nothing (it now raises a visible "form session expired" error so users know to try again). + = 1.6.6 = _Release date: 2026-09-17_ @@ -76,14 +84,6 @@ _Release date: 2026-09-17_ * Fatal error on the login screen with newer WordPress versions: the `login_message` filter can deliver null when no message is set (observed on WordPress 7.x with PHP 8.4, TypeError on a plain visit to wp-login.php). The message callback now accepts `string|null` and coalesces null to an empty string. * Hardened all externally-fed filter callbacks against null payloads: the four `authenticate` callbacks now accept `string|null` credentials (custom REST/SSO endpoints are known to apply the filter with null), and the `wp_redirect` filter callback coalesces a null location. -= 1.6.4 = - -_Release date: 2026-09-11_ - -**Fixed** - -* Compatibility with Restrict Content Pro's "Hijack Login URL" option: RCP's `login_url` filter made every `wp_login_url()` call return a membership page, so the 2FA verification redirect landed on a restricted page where the verification form cannot render, and the visitor was bounced to the registration page. Verification-stage URLs are now built from the canonical `wp-login.php`, mirroring WordPress core's URL construction before the filterable output. The "Back to login" link keeps the site-configured login URL. - = Previous versions = For the full changelog see the [changelog](https://www.robotstxt.software/plugins/robotstxt-2fa/) page. diff --git a/robotstxt-2fa.php b/robotstxt-2fa.php index 8ff56f1..1fb6b43 100644 --- a/robotstxt-2fa.php +++ b/robotstxt-2fa.php @@ -4,7 +4,7 @@ * Plugin URI: https://www.robotstxt.software/plugins/robotstxt-2fa/ * Update URI: https://www.robotstxt.software/plugins/robotstxt-2fa/ * Description: Adds two-factor authentication to the WordPress login flow. - * Version: 1.6.6 + * Version: 1.6.7 * Author: ROBOTSTXT * Author URI: https://www.robotstxt.software/ * Text Domain: robotstxt-2fa @@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) { } if ( ! defined( 'ROBOTSTXT_2FA_VERSION' ) ) { - define( 'ROBOTSTXT_2FA_VERSION', '1.6.6' ); + define( 'ROBOTSTXT_2FA_VERSION', '1.6.7' ); } if ( ! defined( 'ROBOTSTXT_2FA_FILE' ) ) { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 7328496..3b5c785 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'robotstxt/robotstxt-2fa', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'f1d493aefc9da797d99b3b635736b6c627166ddf', + 'reference' => '2b6e97d03ffbc5f7734bbd30413c979f50de3d15', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -40,7 +40,7 @@ 'robotstxt/robotstxt-2fa' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'f1d493aefc9da797d99b3b635736b6c627166ddf', + 'reference' => '2b6e97d03ffbc5f7734bbd30413c979f50de3d15', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), From 1ff471299e07d02f7af07529b10e069b0d73365a Mon Sep 17 00:00:00 2001 From: Javier Casares Date: Wed, 4 Nov 2026 14:36:03 +0000 Subject: [PATCH 07/10] v1.6.8 --- changelog.txt | 24 +++++ includes/class-email-notifications.php | 37 +++++++ includes/login/class-email-code-sender.php | 50 +++++++++ includes/login/class-login-form-manager.php | 111 ++++++++++++++++++-- readme.txt | 23 ++-- robotstxt-2fa.php | 4 +- uninstall.php | 1 + vendor/composer/installed.php | 4 +- 8 files changed, 230 insertions(+), 24 deletions(-) diff --git a/changelog.txt b/changelog.txt index 67c38b2..c55e23f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,29 @@ == Changelog == += 1.6.8 = + +_Release date: 2026-09-21_ + +**Added** + +* Administrator visibility when email delivery fails: failed verification-code deliveries record a marker and administrators see a persistent, self-clearing notice ("2FA: email delivery is failing…") in wp-admin and the network admin, since forced-email users cannot sign in while delivery is broken. The notice disappears automatically once a code is delivered successfully. + +**Fixed** + +* "We could not determine which account you are trying to access" during verification: the pending-stage token was stored in a transient, which external object caches (Redis/Memcached) can evict at any time, killing live verification sessions. Tokens now live in a persistent option map (capped, pruned, consumed on success, cleaned on uninstall) and the error message now says the session expired and asks the user to sign in again. + +**Compatibility** + +* WordPress: 5.6 – 7.1 +* PHP: 8.0 – 8.5 + +**Tests** + +* PHP Coding Standards: PHP_CodeSniffer 3.13.6 / WPCS 3.4.1 — 0 errors +* PHPStan: level 9 — 0 errors +* PHPCompatibility: 8.0–8.5 — 0 issues +* PHPUnit: 9.6.36 — 110 tests, 220 assertions + = 1.6.7 = _Release date: 2026-09-17_ diff --git a/includes/class-email-notifications.php b/includes/class-email-notifications.php index 67bfdaa..8db31b1 100644 --- a/includes/class-email-notifications.php +++ b/includes/class-email-notifications.php @@ -7,6 +7,7 @@ namespace Robotstxt\TwoFA; +use Robotstxt\TwoFA\Login\Email_Code_Sender; use Robotstxt\TwoFA\User\Two_Factor_Config; if ( ! defined( 'ABSPATH' ) ) { @@ -61,6 +62,42 @@ class Email_Notifications { add_action( self::DIGEST_CRON_HOOK, array( $this, 'send_digest' ) ); add_filter( 'cron_schedules', array( $this, 'add_cron_schedules' ) ); add_action( 'init', array( $this, 'maybe_schedule_digest' ) ); + add_action( 'admin_notices', array( $this, 'render_delivery_failure_notice' ) ); + add_action( 'network_admin_notices', array( $this, 'render_delivery_failure_notice' ) ); + } + + /** + * Warn administrators while verification-code delivery is failing. + * + * When a role forces email verification and wp_mail() fails, users are + * locked out at the login challenge with an error that points them at + * their administrator — while the real fault is the site's mail + * configuration. The failure marker is written by + * {@see Email_Code_Sender} on failed delivery and removed automatically + * once a code is delivered successfully. + * + * @since 1.6.8 + * + * @return void + */ + public function render_delivery_failure_notice(): void { + if ( ! current_user_can( 'manage_options' ) ) { + return; + } + + $failure = get_option( Email_Code_Sender::MAIL_FAILURE_OPTION, array() ); + + if ( ! is_array( $failure ) || empty( $failure['at'] ) ) { + return; + } + ?> +
+

+ + +

+
+ user_email, $email_subject, $message, $headers ) ) { + $this->record_mail_failure( $user->user_email ); + return false; } + $this->clear_mail_failure(); + $this->user_settings_repository->store_email_challenge( $user->ID, $code, $expires ); return true; } + /** + * Record a failed verification-code delivery for administrator visibility. + * + * When a role forces email verification, a failing wp_mail() locks users + * out of their accounts with no site-side signal. Store the failure so an + * admin notice can explain the root cause. + * + * @since 1.6.8 + * + * @param string $to Intended recipient. + * + * @return void + */ + private function record_mail_failure( string $to ): void { + $existing = get_option( self::MAIL_FAILURE_OPTION, array() ); + $record = is_array( $existing ) ? $existing : array(); + + update_option( + self::MAIL_FAILURE_OPTION, + array( + 'at' => time(), + 'to' => $to, + 'count' => ( isset( $record['count'] ) && is_numeric( $record['count'] ) ? (int) $record['count'] : 0 ) + 1, + ), + false + ); + } + + /** + * Clear the delivery failure marker after a successful delivery. + * + * @since 1.6.8 + * + * @return void + */ + private function clear_mail_failure(): void { + delete_option( self::MAIL_FAILURE_OPTION ); + } + /** * Verify a submitted code against the stored challenge. * diff --git a/includes/login/class-login-form-manager.php b/includes/login/class-login-form-manager.php index 3f00773..f575ddd 100644 --- a/includes/login/class-login-form-manager.php +++ b/includes/login/class-login-form-manager.php @@ -85,9 +85,21 @@ class Login_Form_Manager { private const FIELD_METHOD = 'robotstxt_2fa_method'; /** - * Transient key prefix for pending-stage tokens. + * Option key storing the pending-stage token map. + * + * Maps token => array( user ID, expiry ). Persistent storage instead of a + * transient: external object caches can evict transients at any time, + * which would kill live verification stages and lock users out with + * "We could not determine which account you are trying to access." */ - private const PENDING_TRANSIENT_PREFIX = 'robotstxt_2fa_stage_'; + private const PENDING_OPTION = 'robotstxt_2fa_pending_stages'; + + /** + * Maximum concurrent pending-stage tokens kept in the map. + * + * The map is pruned on every write; the cap bounds its size. + */ + private const PENDING_MAX_TOKENS = 20; /** * Pending-stage token TTL in seconds — matches WP nonce lifetime (24 h). @@ -649,7 +661,7 @@ class Login_Form_Manager { $authenticated_user = $this->resolve_pending_user(); if ( null === $authenticated_user ) { - return new \WP_Error( 'robotstxt_2fa_unknown_user', __( 'We could not determine which account you are trying to access.', 'robotstxt-2fa' ) ); + return new \WP_Error( 'robotstxt_2fa_unknown_user', __( 'Your verification session expired or could not be found. Please sign in again.', 'robotstxt-2fa' ) ); } // Brute-force: check if the account is currently locked out. @@ -753,7 +765,7 @@ class Login_Form_Manager { // Consume the pending token so it cannot be replayed. $pending_token = $this->get_requested_pending_token(); if ( '' !== $pending_token ) { - delete_transient( self::PENDING_TRANSIENT_PREFIX . $pending_token ); + $this->consume_pending_token( $pending_token ); } $this->user_settings_repository->record_last_verification( @@ -1333,21 +1345,99 @@ class Login_Form_Manager { /** * Issue an opaque pending-stage token that maps to a user ID. * - * Stores the user ID in a short-lived transient so the login username - * is never transmitted in the URL query string. + * Stores the token in a persistent option map (see PENDING_OPTION) so the + * login username is never transmitted in the URL query string and object + * cache eviction cannot kill a live stage. * * @since 1.3.0 + * @since 1.6.8 Stored in a persistent option map instead of a transient. * * @param int $user_id User identifier. * * @return string 32-character alphanumeric token. */ private function issue_pending_token( int $user_id ): string { + $tokens = $this->get_pending_token_map(); + $now = time(); + + foreach ( $tokens as $existing_token => $data ) { + if ( $data['e'] <= $now ) { + unset( $tokens[ $existing_token ] ); + } + } + $token = wp_generate_password( 32, false, false ); - set_transient( self::PENDING_TRANSIENT_PREFIX . $token, $user_id, self::PENDING_TTL ); + + $tokens[ $token ] = array( + 'u' => $user_id, + 'e' => $now + self::PENDING_TTL, + ); + + if ( count( $tokens ) > self::PENDING_MAX_TOKENS ) { + uasort( + $tokens, + static function ( array $a, array $b ): int { + return (int) $a['e'] <=> (int) $b['e']; + } + ); + + $tokens = array_slice( $tokens, -self::PENDING_MAX_TOKENS, null, true ); + } + + update_option( self::PENDING_OPTION, $tokens, false ); + return $token; } + /** + * Retrieve the raw pending-stage token map stored in the database. + * + * @since 1.6.8 + * + * @return array Token => user ID + expiry. + */ + private function get_pending_token_map(): array { + $raw = get_option( self::PENDING_OPTION, array() ); + + if ( ! is_array( $raw ) ) { + return array(); + } + + $tokens = array(); + + foreach ( $raw as $token => $data ) { + if ( is_string( $token ) && is_array( $data ) && isset( $data['u'], $data['e'] ) && is_numeric( $data['u'] ) && is_numeric( $data['e'] ) ) { + $tokens[ $token ] = array( + 'u' => (int) $data['u'], + 'e' => (int) $data['e'], + ); + } + } + + return $tokens; + } + + /** + * Remove a consumed pending-stage token from the map. + * + * @since 1.6.8 + * + * @param string $token Token to consume. + * + * @return void + */ + private function consume_pending_token( string $token ): void { + $tokens = $this->get_pending_token_map(); + + if ( ! isset( $tokens[ $token ] ) ) { + return; + } + + unset( $tokens[ $token ] ); + + update_option( self::PENDING_OPTION, $tokens, false ); + } + /** * Retrieve the raw pending-stage token from the current request. * @@ -1373,6 +1463,7 @@ class Login_Form_Manager { * Resolve the pending-stage token to its associated WP_User. * * @since 1.3.0 + * @since 1.6.8 Reads the persistent token map instead of a transient. * * @return \WP_User|null Null when no valid token is present. */ @@ -1383,13 +1474,13 @@ class Login_Form_Manager { return null; } - $user_id_raw = get_transient( self::PENDING_TRANSIENT_PREFIX . $token ); + $data = $this->get_pending_token_map()[ $token ] ?? null; - if ( ! is_numeric( $user_id_raw ) ) { + if ( null === $data || $data['e'] <= time() ) { return null; } - $user = get_user_by( 'ID', (int) $user_id_raw ); + $user = get_user_by( 'ID', $data['u'] ); return $user instanceof \WP_User ? $user : null; } diff --git a/readme.txt b/readme.txt index fd801dc..1b69ea6 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: security, two-factor authentication, login, otp Requires at least: 5.6 Tested up to: 7.0 Requires PHP: 8.0 -Stable tag: 1.6.7 +Stable tag: 1.6.8 License: GPLv3 or later License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -59,6 +59,18 @@ Yes. Activate the plugin at the network level. Network administrators can set an == Changelog == += 1.6.8 = + +_Release date: 2026-09-21_ + +**Added** + +* Administrator visibility when email delivery fails: failed verification-code deliveries record a marker and administrators see a persistent, self-clearing notice ("2FA: email delivery is failing…") in wp-admin and the network admin, since forced-email users cannot sign in while delivery is broken. + +**Fixed** + +* "We could not determine which account you are trying to access" during verification: the pending-stage token was stored in a transient, which external object caches (Redis/Memcached) can evict at any time, killing live verification sessions. Tokens now live in a persistent option map and the error message asks the user to sign in again. + = 1.6.7 = _Release date: 2026-09-17_ @@ -75,15 +87,6 @@ _Release date: 2026-09-17_ * Forced-enrollment warning on the profile 2FA section: when a user's role enforces 2FA but they have no verification method configured yet, the 2FA section of their profile (wp-admin and the frontend shortcode) opens with a warning notice asking them to activate at least one method. While a grace period is active, the notice appends the remaining days. -= 1.6.5 = - -_Release date: 2026-09-17_ - -**Fixed** - -* Fatal error on the login screen with newer WordPress versions: the `login_message` filter can deliver null when no message is set (observed on WordPress 7.x with PHP 8.4, TypeError on a plain visit to wp-login.php). The message callback now accepts `string|null` and coalesces null to an empty string. -* Hardened all externally-fed filter callbacks against null payloads: the four `authenticate` callbacks now accept `string|null` credentials (custom REST/SSO endpoints are known to apply the filter with null), and the `wp_redirect` filter callback coalesces a null location. - = Previous versions = For the full changelog see the [changelog](https://www.robotstxt.software/plugins/robotstxt-2fa/) page. diff --git a/robotstxt-2fa.php b/robotstxt-2fa.php index 1fb6b43..6e966cc 100644 --- a/robotstxt-2fa.php +++ b/robotstxt-2fa.php @@ -4,7 +4,7 @@ * Plugin URI: https://www.robotstxt.software/plugins/robotstxt-2fa/ * Update URI: https://www.robotstxt.software/plugins/robotstxt-2fa/ * Description: Adds two-factor authentication to the WordPress login flow. - * Version: 1.6.7 + * Version: 1.6.8 * Author: ROBOTSTXT * Author URI: https://www.robotstxt.software/ * Text Domain: robotstxt-2fa @@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) { } if ( ! defined( 'ROBOTSTXT_2FA_VERSION' ) ) { - define( 'ROBOTSTXT_2FA_VERSION', '1.6.7' ); + define( 'ROBOTSTXT_2FA_VERSION', '1.6.8' ); } if ( ! defined( 'ROBOTSTXT_2FA_FILE' ) ) { diff --git a/uninstall.php b/uninstall.php index 84312a2..650e47e 100644 --- a/uninstall.php +++ b/uninstall.php @@ -45,6 +45,7 @@ if ( ! robotstxt_2fa_should_delete_data() ) { delete_option( 'robotstxt_2fa_settings' ); delete_option( 'robotstxt_2fa_failed_log' ); delete_option( 'robotstxt_2fa_geoip_status' ); +delete_option( 'robotstxt_2fa_pending_stages' ); delete_site_option( 'robotstxt_2fa_settings' ); // Clear the GeoIP auto-download cron event. diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 3b5c785..102d091 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'robotstxt/robotstxt-2fa', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '2b6e97d03ffbc5f7734bbd30413c979f50de3d15', + 'reference' => '70737383aa72a4fb75363c9d084ec3a7112f8d3b', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -40,7 +40,7 @@ 'robotstxt/robotstxt-2fa' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '2b6e97d03ffbc5f7734bbd30413c979f50de3d15', + 'reference' => '70737383aa72a4fb75363c9d084ec3a7112f8d3b', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), From 7379505d20fe928118136f298d42ab6b7af842c7 Mon Sep 17 00:00:00 2001 From: Javier Casares Date: Wed, 4 Nov 2026 14:37:18 +0000 Subject: [PATCH 08/10] v1.6.9 --- changelog.txt | 28 +++ includes/admin/class-dashboard-page.php | 14 +- includes/admin/class-migration-page.php | 24 ++- includes/admin/class-settings-page.php | 13 +- includes/admin/class-users-list-table.php | 9 +- includes/class-email-notifications.php | 4 + includes/login/class-login-form-manager.php | 14 +- includes/rest/class-rest-controller.php | 9 +- includes/user/class-frontend-profile.php | 7 +- includes/user/class-profile-settings.php | 2 +- includes/user/class-trusted-devices.php | 18 +- readme.txt | 45 ++-- robotstxt-2fa.php | 8 +- uninstall.php | 12 +- vendor/composer/installed.json | 21 +- vendor/composer/installed.php | 10 +- vendor/maxmind-db/reader/CHANGELOG.md | 45 ++++ vendor/maxmind-db/reader/README.md | 39 +++- vendor/maxmind-db/reader/composer.json | 7 +- .../ext/bundled-include/maxminddb_config.h | 37 ++++ vendor/maxmind-db/reader/ext/config.m4 | 133 ++++++++++-- vendor/maxmind-db/reader/ext/config.w32 | 113 +++++++++- vendor/maxmind-db/reader/ext/maxminddb.c | 4 +- vendor/maxmind-db/reader/ext/php_maxminddb.h | 2 +- .../reader/ext/tests/003-open-basedir.phpt | 11 + vendor/maxmind-db/reader/lychee.toml | 54 +++++ vendor/maxmind-db/reader/mise.lock | 69 ++++++ vendor/maxmind-db/reader/mise.toml | 10 + vendor/maxmind-db/reader/package.xml | 48 ++++- .../reader/src/MaxMind/Db/Reader.php | 32 ++- .../reader/src/MaxMind/Db/Reader/Decoder.php | 203 ++++++++++++++++-- .../reader/src/MaxMind/Db/Reader/Util.php | 6 +- 32 files changed, 912 insertions(+), 139 deletions(-) create mode 100644 vendor/maxmind-db/reader/ext/bundled-include/maxminddb_config.h create mode 100644 vendor/maxmind-db/reader/lychee.toml create mode 100644 vendor/maxmind-db/reader/mise.lock create mode 100644 vendor/maxmind-db/reader/mise.toml diff --git a/changelog.txt b/changelog.txt index c55e23f..d2abf8c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,33 @@ == Changelog == += 1.6.9 = + +_Release date: 2026-11-03_ + +**Changed** + +* Compatibility floors raised: minimum WordPress moved from 5.6 to 7.0 and minimum PHP from 8.0 to 8.3, matching the support policy (latest stable WordPress plus the two previous majors). The full-range compatibility review (WordPress 4.7-7.2 walked down with wp-compat; PHP 5.6-8.6 scanned with PHPCompatibility) confirmed the plugin uses no WordPress symbols newer than 6.0 and no PHP syntax newer than 8.0, so the real code floors are lower — the declared floors are the supported ones. WordPress 7.2 (beta 4, single-site) and WordPress 7.0 (multisite) were live-tested; PHP 8.6 (RC 3) was live-tested and PHP 8.3-8.6 scanned clean. +* The admin menu icon is now a brand SVG (shield with keyhole, base64 data URI) instead of `dashicons-shield`, on both single-site and network admin menus. WordPress core natively renders base64 SVG menu icons (centered at 20px), so the icon works identically on WordPress 7.0, 7.1 and 7.2, stays crisp on high-density screens, and is future-proof against the admin-wide move from Dashicons to SVG icons tracked in WordPress core (PR #12270 / Trac ticket #65089). Dashicons continue to work everywhere else. +* Composer tooling updated: wp-compat 3.0.1, PHPStan 2.3.5, wordpress-stubs 7.1.2, PHPUnit 9.6.38, maxmind-db/reader 1.14.0; `composer audit` reports no known vulnerabilities. + +**Fixed** + +* PHP 8.6 deprecation removed: the REST controller declared a class constant named `namespace` (case-insensitively), which PHP 8.6 deprecates and PHP 9 will reject as a fatal error. Renamed to `REST_NAMESPACE` with no functional change (the constant was private). +* Static-analysis hardening to pass PHPStan at the new maximum level (10) without a baseline: `$wpdb`, `$wp_filter` and `$post` globals are now properly typed; the uninstall routine deletes user meta through the `$wpdb->delete()` WordPress API instead of hand-built SQL; role names from `get_editable_roles()` are validated before translation; `AUTH_SALT` and `COOKIEPATH` are validated as strings before use in the trusted-device cookie; the trusted-device map discards corrupted non-string keys; `get_users()` results are instance-checked before use; a misplaced translators comment on an `_n()` call was fixed (WPCS error). + +**Compatibility** + +* WordPress: 7.0 - 7.2 +* PHP: 8.3 - 8.6 + +**Tests** + +* PHP Coding Standards: PHP_CodeSniffer 3.13.6 / WPCS 3.4.1 — 0 errors, 1 accepted advisory warning (urlencode mirrors WordPress core's wp_login_url()) +* PHPStan: 2.3.5 level max (10), no baseline — 0 errors +* PHPCompatibility: 9.3.5, testVersion 8.3-8.6 — 0 issues +* PHPUnit: 9.6.38 — 110 tests, 220 assertions (PHP 8.6.0RC3 and PHP 8.3.36) +* Live smoke tests: WordPress 7.2-beta4 (single site) and WordPress 7.0 (multisite) on PHP 8.6.0RC3, MariaDB 11.8.9 + = 1.6.8 = _Release date: 2026-09-21_ diff --git a/includes/admin/class-dashboard-page.php b/includes/admin/class-dashboard-page.php index fdf4b09..7517c0e 100644 --- a/includes/admin/class-dashboard-page.php +++ b/includes/admin/class-dashboard-page.php @@ -24,6 +24,18 @@ class Dashboard_Page { */ public const PAGE_SLUG = 'robotstxt-2fa-dashboard'; + /** + * Brand SVG menu icon (shield with keyhole) as a base64 data URI. + * + * WordPress core renders base64-encoded SVG data URIs natively in admin + * menus (centered at 20px via the .wp-menu-image.svg CSS class), which + * keeps the icon crisp and independent of the Dashicons font while + * remaining fully backward compatible. + * + * @since 1.6.9 + */ + public const MENU_ICON = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIiByb2xlPSJpbWciIGFyaWEtaGlkZGVuPSJ0cnVlIiBmb2N1c2FibGU9ImZhbHNlIj48cGF0aCBmaWxsPSIjMDM4N2M5IiBkPSJNMTAgMSAxOCAzLjl2NS4zYzAgNS40LTMuMyA4LjYtOCA5LjgtNC43LTEuMi04LTQuNC04LTkuOFYzLjlaIi8+PGNpcmNsZSBjeD0iMTAiIGN5PSI4IiByPSIyLjIiIGZpbGw9IiNmZmVmZDQiLz48cGF0aCBmaWxsPSIjZmZlZmQ0IiBkPSJNOC44IDkuOSA3LjYgMTMuN2g0LjhMMTEuMiA5LjlaIi8+PC9zdmc+'; + /** * Failed attempts log. * @@ -108,7 +120,7 @@ class Dashboard_Page { 'manage_options', self::PAGE_SLUG, array( $this, 'render_page' ), - 'dashicons-shield' + self::MENU_ICON ); add_submenu_page( diff --git a/includes/admin/class-migration-page.php b/includes/admin/class-migration-page.php index d4456c2..91c6aa3 100644 --- a/includes/admin/class-migration-page.php +++ b/includes/admin/class-migration-page.php @@ -538,6 +538,11 @@ class Migration_Page { * @return array */ private function get_candidates_from_wordfence(): array { + /** + * WordPress database abstraction. Typed for PHPStan level max. + * + * @var \wpdb $wpdb + */ global $wpdb; $table = $wpdb->prefix . self::WORDFENCE_TABLE; @@ -550,21 +555,17 @@ class Migration_Page { return array(); } - // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table names are trusted constants. + // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is a trusted prefix constant; the user ID is a validated integer. $rows = $wpdb->get_results( "SELECT s.user_id, s.secret FROM `{$table}` s", ARRAY_A ); // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared - if ( ! is_array( $rows ) ) { - return array(); - } - $candidates = array(); foreach ( $rows as $row ) { - if ( ! is_array( $row ) || ! isset( $row['user_id'] ) || ! is_numeric( $row['user_id'] ) ) { + if ( ! isset( $row['user_id'] ) || ! is_numeric( $row['user_id'] ) ) { continue; } @@ -716,14 +717,19 @@ class Migration_Page { * @return string */ private function read_wordfence_secret( int $user_id ): string { + /** + * WordPress database abstraction. Typed for PHPStan level max. + * + * @var \wpdb $wpdb + */ global $wpdb; $table = $wpdb->prefix . self::WORDFENCE_TABLE; - // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is a trusted constant. - $secret_binary = $wpdb->get_var( $wpdb->prepare( "SELECT `secret` FROM `{$table}` WHERE `user_id` = %d LIMIT 1", $user_id ) ); + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is a trusted prefix constant; the user ID is a validated integer. + $secret_binary = $wpdb->get_var( "SELECT `secret` FROM `{$table}` WHERE `user_id` = {$user_id} LIMIT 1" ); - if ( ! is_string( $secret_binary ) || '' === $secret_binary ) { + if ( ! is_string( $secret_binary ) ) { return ''; } diff --git a/includes/admin/class-settings-page.php b/includes/admin/class-settings-page.php index 904a7c4..94c9036 100644 --- a/includes/admin/class-settings-page.php +++ b/includes/admin/class-settings-page.php @@ -431,8 +431,13 @@ class Settings_Page {
$role_details ) : ?> + - + $method_label ) : ?>