== Changelog ==

= 1.3.0 =

_Release date: 2026-06-05_

**Security**

* TOTP replay prevention: accepted counter step stored in a 90-second transient; same code rejected on second submission within the ±1 window.
* Login username removed from 2FA redirect URLs: `robotstxt-2fa-login` query parameter replaced with an opaque 32-character token resolved server-side. Username never appears in browser history, logs, or referrer headers.

**Added**

* WP-CLI command family `wp 2fa` (loaded only when `WP_CLI` is defined):
  * `wp 2fa status <user_id>` — show 2FA configuration.
  * `wp 2fa enable <user_id> [--method=<method>]` — enable 2FA.
  * `wp 2fa disable <user_id>` — disable 2FA, preserving secrets and codes.
  * `wp 2fa reset-recovery <user_id>` — regenerate and display recovery codes.
  * `wp 2fa list [--role=<role>] [--without-2fa] [--format=table|csv|json]` — list users with 2FA status.
  * `wp 2fa force-setup [<user_id>] [--role=<role>] [--method=<method>]` — enforce 2FA.
  * `wp 2fa bypass <user_id> [--days=<n>]` — grant temporary bypass (max 30 days).

**Compatibility**

* WordPress: 6.4 – 7.1
* PHP: 8.0 – 8.5

**Tests**

* PHP Coding Standards: PHP_CodeSniffer 3.13.5 / WPCS 3.3.0
* PHPStan: level 9 — 0 errors
* PHPCompatibility: 8.0–8.5 — 0 issues
* PHPUnit: 9.6.34 — 42 tests, 109 assertions

= 1.2.1 =

_Release date: 2026-06-05_

**Fixed**

* Recovery code confirmation without the method checkbox now correctly activates the method.
* Fatal error on admin profile pages (add_settings_error not available at init in multisite).
* OTP and recovery text inputs no longer disabled by JS when Enable toggle is off.
* Regenerate codes now requires re-confirmation before the method reactivates.
* Entering a valid OTP or recovery code activates the method even without checking the checkbox.
* Recovery regeneration field validated with strict value check.

**Compatibility**

* WordPress: 6.4 – 7.1
* PHP: 8.0 – 8.5

**Tests**

* PHP Coding Standards: PHP_CodeSniffer 3.13.5 / WPCS 3.3.0
* PHPStan: level 9 — 0 errors
* PHPCompatibility: 8.0–8.5 — 0 issues
* PHPUnit: 9.6.34 — 42 tests, 109 assertions

= 1.1.0 =

_Release date: 2026-06-05_

**Added**

* Developer filter/action hooks: `robotstxt_2fa_skip_challenge`, `robotstxt_2fa_verification_success`, `robotstxt_2fa_verification_failed`, `robotstxt_2fa_method_enabled`, `robotstxt_2fa_method_disabled`, `robotstxt_2fa_code_length`, `robotstxt_2fa_code_ttl`, `robotstxt_2fa_resend_interval`, `robotstxt_2fa_email_subject`, `robotstxt_2fa_email_message`, `robotstxt_2fa_before_send_email`.
* `robotstxt_2fa_required_methods_for_user` filter to override per-user method requirements.
* `robotstxt_2fa_profile_wrapper_class` filter for the frontend shortcode container.
* `[robotstxt_2fa_profile]` shortcode — renders the full 2FA settings section on any WordPress page without requiring wp-admin access. Supports `user_id` and `redirect` attributes.
* `top_up_codes_for_user()` method on `Recovery_Codes` — generates only the missing codes to fill the batch back to 10, preserving existing unused codes.
* "Regenerate codes" button on the profile when recovery codes are active, without needing to disable and re-enable the method.

**Compatibility**

* WordPress: 6.4 – 7.1
* PHP: 8.0 – 8.5

**Tests**

* PHP Coding Standards: PHP_CodeSniffer 3.13.5 / WPCS 3.3.0
* PHPStan: level 9 — 0 errors
* PHPCompatibility: 8.0–8.5 — 0 issues
* PHPUnit: 9.6.34 — 42 tests, 109 assertions

= 1.0.0 =

_Release date: 2026-06-05_

**Fixed**

* Enable 2FA checkbox now defaults to email and pre-checks it in the UI on first activation.
* QR code for authenticator apps now displays correctly in the user profile.
* "Send the code again" link is disabled for 60 seconds after delivery with a live countdown.

**Changed**

* Recovery codes section redesigned: plain list with code chips, no coloured notification box.
* 2FA login screen links now in a vertical list for better readability.

**Removed**

* "Generate new secret" button from the OTP section.

**Compatibility**

* WordPress: 6.4 – 7.1
* PHP: 8.0 – 8.5

**Tests**

* PHP Coding Standards: PHP_CodeSniffer 3.13.5 / WPCS 3.3.0
* PHPStan: level 9 — 0 errors
* PHPCompatibility: 8.0–8.5 — 0 issues
* PHPUnit: 9.6.34 — 42 tests, 109 assertions

= 0.3.0 =

_Release date: 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).
* Recovery code preview transient TTL reduced from indefinite to 5 minutes.

**Fixed**

* Network admin settings now save correctly via a dedicated handler writing to `wp_sitemeta`.
* Settings option registered with `autoload=false`.
* `update.json` corrected to reference the 2FA plugin instead of the SMTP plugin.

**Compatibility**

* WordPress: 6.4 – 7.1
* PHP: 8.0 – 8.5

**Tests**

* PHP Coding Standards: PHP_CodeSniffer 3.13.5 / WPCS 3.3.0
* PHPStan: level 9 — 0 errors
* PHPCompatibility: 8.0–8.5 — 0 issues
* PHPUnit: 9.6.34 — 42 tests, 109 assertions

= 0.2.0 =

_Release date: 2026-06-05_

**Added**

* Per-role 2FA method matrix with select-all row/column controls.
* Authenticator app (TOTP) support with QR provisioning and manual setup key.
* Recovery codes: 10 single-use 8-digit codes with confirmation workflow.
* Email-based verification codes with 60-second resend throttle and 10-minute expiry.
* Configurable verification frequency (every login, daily, weekly, monthly) per device.
* Dedicated stage token (WP nonce) securing the 2FA screen.
* Network-wide multisite support.
* Admin settings page with top-level menu.

**Changed**

* Profile method checkboxes require explicit confirmation before activation.

**Fixed**

* QR generation errors caught; recovery-code preview persists until acknowledged.

**Compatibility**

* WordPress: 6.4 – 7.0
* PHP: 8.0 – 8.5

**Tests**

* PHP Coding Standards: PHP_CodeSniffer 3.13.5 / WPCS 3.3.0
* PHPStan: level 9 — 0 errors
* PHPUnit: 9.6.34

= 0.1.0 =

_Release date: 2024-04-08_

**Added**

* Initial plugin skeleton.
* Documentation files.
* Placeholder classes for login handling, profile integration, and admin settings.
