This commit is contained in:
Javier Casares 2026-06-05 14:06:16 +00:00
commit 968211baad

View file

@ -1,42 +1,69 @@
# Changelog
## [Unreleased]
### Added
- Authenticator app support with stored secrets and QR provisioning powered by the optional `bacon/bacon-qr-code` library.
- Recovery code confirmation workflow that requires entering one of the freshly generated codes before hiding them.
- Single-use recovery codes with profile management, one-time display, and login validation.
- Dedicated verification stage token that secures 2FA screens and allows protected email code resends.
- Admin settings page with role-based enforcement controls for two-factor authentication.
- Uninstall routine that removes stored plugin options.
- Network-wide enforcement options for WordPress multisite installations.
- Email-based verification codes with throttled delivery and expiry handling.
- Configurable verification frequency that remembers trusted devices while allowing administrators to lock the schedule per site.
### Changed
- Profile method toggles now start unchecked and require validating authenticator and recovery codes before activation, with new inline prompts and regenerated secrets when options are disabled.
- The profile screen now keeps recovery codes visible in a two-column grid until one is confirmed, shows remaining counts, and automatically refreshes the list when the stored batch is exhausted.
- Email verification now displays the destination address alongside the method label.
- The login verification screen now hides the username/password fields, exposes a back-to-login link, and supports email code resends from a dedicated query-flagged URL.
- The verification stage now enforces authenticator app codes when they are enabled and exposes secure links to switch between OTP, email, and recovery-code challenges without restarting the login.
- Promoted the settings interface to a dedicated top-level Two-Factor Authentication menu for easier discovery.
- Adjusted the Two-Factor Authentication menu position so it appears within the plugins section of the admin navigation.
- User profile settings now persist preferences and automatically enforce role-based 2FA requirements.
- The login screen now auto-submits verification forms once the active method reaches its required length (six digits for OTP, seven for email, eight for recovery codes) and removes the Remember Me control during OTP checks.
- Recovery code requests now submit through the native profile form, regenerate codes server-side, and remember the section anchor on the redirect so the refreshed screen focuses the two-factor settings.
- The refreshed profile screen renders the newly issued ten codes inside a notice, including copy controls and updated status messaging, without relying on JavaScript-driven form submissions.
- The generator button now submits the profile form directly, honours core capability checks, and shares nonce validation with the existing profile workflow.
## [0.3.0] - 2026-06-05
### Added
- Delete-on-uninstall option (disabled by default — all plugin data is preserved on removal).
### Security
- Email verification codes now use `random_int()` (CSPRNG) for cryptographically secure code generation.
- Recovery code preview transient TTL reduced from indefinite to 5 minutes.
### Fixed
- Prevented a fatal error on the profile screen by exposing the recovery code batch size helper used during rendering.
- Corrected the recovery-code confirmation flow so previews persist until acknowledged and the confirmation code is accepted.
- Hardened authenticator QR generation by catching library errors and pointing administrators to the required bacon/bacon-qr-code ^3.0 dependency.
- Improved recovery-code AJAX error handling so failed requests surface localized messages instead of silently failing.
- Forced roles now see two-factor authentication enabled with the default email method selected in their profile, and per-user data is purged during uninstall.
- Restored the login verification handlers so the authenticate filter no longer triggers fatal errors and email challenges complete successfully.
- Ensured the profile recovery-code generator always reaches `admin-ajax.php`, even when localized data is missing, so the button reliably displays the codes inline.
- Network admin settings now save correctly via a dedicated handler writing to `wp_sitemeta`.
- Settings option registered with `autoload=false` to avoid loading on every page request.
- `update.json` corrected to reference the 2FA plugin instead of the SMTP plugin.
**Compatibility**
* WordPress: 6.4 – 7.1
* PHP: 8.2 – 8.5
**Tests**
* PHP Coding Standards: PHP_CodeSniffer 3.13.5 / WPCS 3.3.0
* PHPStan: level 9 — 0 errors
* PHPCompatibility: 8.2–8.5 — 0 issues
* PHPUnit: 9.6.34 — 42 tests, 109 assertions
## [0.2.0] - 2026-06-05
### Added
- Per-role 2FA method matrix in admin settings: administrators can now choose exactly which verification methods (email, authenticator app, recovery codes) are required for each WordPress role, with select-all row and column controls.
- Authenticator app (TOTP) support: stored secrets, QR code provisioning via `bacon/bacon-qr-code`, manual setup key display, and one-time activation confirmation.
- Recovery codes: 10 single-use 8-digit codes with profile management, one-time display grid, copy-to-clipboard, and mandatory confirmation before activation.
- Email-based verification codes with throttled delivery (60 s resend cooldown) and 10-minute expiry.
- Configurable verification frequency (every login, daily, weekly, or every 28 days) remembered per device fingerprint; administrators can lock the global schedule.
- Dedicated verification stage token (WP nonce) securing the 2FA screen between password validation and code submission.
- Secure method-switch links on the verification screen letting users change between OTP, email, and recovery-code challenges without restarting the login.
- Network-wide multisite support: network administrators can set and lock enforcement settings across all sites (`Network: true` header).
- Uninstall routine removing all plugin options and user meta.
- Admin settings page as a top-level menu with `manage_options` capability guard.
### Changed
- Settings page now uses the per-role method matrix instead of a flat forced-roles list; old `force_roles` + `default_method` data is automatically migrated on first read.
- Profile method checkboxes require explicit confirmation: OTP demands a valid 6-digit code, recovery codes demand entering one of the displayed codes before the method activates.
- Profile screen regenerates the OTP secret when the authenticator method is disabled and provides a "Generate new secret" button.
- Recovery code batch exhaustion now auto-generates a fresh batch and surfaces a confirmation prompt rather than locking the user out.
- Login screen hides the username/password fields, removes the Remember Me checkbox, and focuses the verification code input during the 2FA stage.
- Login form auto-submits once the input reaches the method's expected digit count.
### Fixed
- Hardened authenticator QR generation by catching library errors and guiding administrators to the required dependency.
- Recovery-code preview persists via transient until explicitly acknowledged; fixes cases where codes disappeared before confirmation.
## [0.1.0] - 2024-04-08
### Added
- Initial skeleton for the 2FA (by ROBOTSTXT) plugin.
- Initial documentation files (`readme.txt`, `AGENTS.md`, `changelog.txt`).
- Placeholder classes for login handling, user profile integration, and admin settings.