-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
@@ -540,7 +520,16 @@ class Profile_Settings {
}
}
- toggle.addEventListener( 'change', applyState );
+ toggle.addEventListener( 'change', function () {
+ applyState();
+ // Pre-check email when enabling 2FA for the first time.
+ if ( toggle.checked ) {
+ var emailCheckbox = document.getElementById( 'robotstxt-2fa-method-email' );
+ if ( emailCheckbox && ! emailCheckbox.checked ) {
+ emailCheckbox.checked = true;
+ }
+ }
+ } );
applyState();
}());
@@ -717,12 +706,6 @@ class Profile_Settings {
$otp_was_enabled = in_array( 'otp', $previous_methods, true );
$recovery_was_enabled = in_array( 'recovery_codes', $previous_methods, true );
- $otp_regenerate_requested = isset( $_POST[ self::OTP_REGENERATE_FIELD ] );
-
- if ( $otp_regenerate_requested ) {
- $this->focus_section = true;
- }
-
$otp_code = '';
if ( isset( $_POST[ self::OTP_CODE_FIELD ] ) && is_string( $_POST[ self::OTP_CODE_FIELD ] ) ) {
@@ -746,21 +729,8 @@ class Profile_Settings {
$otp_requested = in_array( 'otp', $requested_methods, true );
$otp_should_remain_enabled = false;
- if ( $otp_regenerate_requested ) {
- $this->otp_manager->delete_secret( $user_id );
- $this->otp_manager->ensure_secret( $user );
- $otp_was_enabled = false;
- $otp_requested = true;
- add_settings_error(
- 'robotstxt-2fa',
- 'robotstxt-2fa-otp-reset',
- __( 'A new authenticator secret is ready. Scan the QR code and confirm it with a fresh code to finish reconnecting.', 'robotstxt-2fa' ),
- 'updated'
- );
- }
-
if ( $otp_was_enabled ) {
- if ( $otp_requested && ! $otp_regenerate_requested ) {
+ if ( $otp_requested ) {
$otp_should_remain_enabled = true;
} else {
$this->otp_manager->delete_secret( $user_id );
@@ -865,6 +835,11 @@ class Profile_Settings {
$selected_methods = array_values( array_unique( $selected_methods ) );
+ // When enabling for the first time without selecting a method, default to email.
+ if ( $enabled && empty( $selected_methods ) && in_array( 'email', $available_keys, true ) ) {
+ $selected_methods[] = 'email';
+ }
+
if ( ! $is_forced && empty( $selected_methods ) ) {
$enabled = false;
}
diff --git a/readme.txt b/readme.txt
index d8fd5ee..9d31fd0 100644
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@ Tags: security, two-factor authentication, login, otp
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 8.2
-Stable tag: 0.3.0
+Stable tag: 1.0.0
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
@@ -59,6 +59,17 @@ Yes. Activate the plugin at the network level. Network administrators can set an
== Changelog ==
+= 1.0.0 =
+
+_Release date: 2026-06-05_
+
+* Fixed: Enable 2FA checkbox now defaults to email method on first activation.
+* Fixed: QR code now renders correctly (data URI was stripped by esc_url).
+* Fixed: Resend link shows a 60-second live countdown to prevent email flooding.
+* Changed: Recovery codes section redesigned — plain list, no green notice box.
+* Changed: 2FA login links now a vertical list instead of inline bullets.
+* Removed: Redundant "Generate new secret" button from OTP section.
+
= 0.3.0 =
_Release date: 2026-06-05_
diff --git a/robotstxt-2fa.php b/robotstxt-2fa.php
index 052ce26..a581647 100644
--- a/robotstxt-2fa.php
+++ b/robotstxt-2fa.php
@@ -3,7 +3,7 @@
* Plugin Name: 2FA (by ROBOTSTXT)
* Plugin URI: https://www.robotstxt.es/plugins/robotstxt-2fa/
* Description: Adds two-factor authentication to the WordPress login flow.
- * Version: 0.3.0
+ * Version: 1.0.0
* Author: ROBOTSTXT
* Author URI: https://www.robotstxt.es/
* Text Domain: robotstxt-2fa
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
if ( ! defined( 'ROBOTSTXT_2FA_VERSION' ) ) {
- define( 'ROBOTSTXT_2FA_VERSION', '0.3.0' );
+ define( 'ROBOTSTXT_2FA_VERSION', '1.0.0' );
}
if ( ! defined( 'ROBOTSTXT_2FA_FILE' ) ) {
diff --git a/templates/.gitkeep b/templates/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/update.json b/update.json
index 9e58c34..cd3b887 100644
--- a/update.json
+++ b/update.json
@@ -1,8 +1,8 @@
{
"name": "2FA (by ROBOTSTXT)",
"slug": "robotstxt-2fa",
- "version": "0.3.0",
- "download_url": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-2fa/releases/download/0.3.0/robotstxt-2fa-0.3.0.zip",
+ "version": "1.0.0",
+ "download_url": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-2fa/releases/download/1.0.0/robotstxt-2fa-1.0.0.zip",
"requires": "6.4",
"requires_php": "8.2",
"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": "
0.3.0 - 2026-06-05
- Added: Per-role 2FA method matrix with select-all row/column controls
- Added: Delete-on-uninstall option (data preserved by default)
- Security: Email verification codes now use CSPRNG (random_int)
- Security: Recovery code preview TTL reduced to 5 minutes
- Fixed: Network admin settings page now saves correctly
0.2.0 - 2026-06-05
- Initial fully featured release with email, OTP, and recovery code authentication
",
+ "changelog": "
1.0.0 - 2026-06-05
- Fixed: Enable 2FA toggle defaults to email on first activation
- Fixed: QR code now displays correctly in user profiles
- Fixed: Resend link shows 60-second countdown
- Changed: Recovery codes redesigned as plain list
- Changed: Login links now vertical list
",
"sections": {
"description": "Adds per-role two-factor authentication to the WordPress login flow. Supports email codes, authenticator apps (TOTP), and recovery codes.",
- "changelog": "
0.3.0 - 2026-06-05
- Added: Per-role 2FA method matrix with select-all row/column controls
- Added: Delete-on-uninstall option (data preserved by default)
- Security: Email verification codes now use CSPRNG (random_int)
- Security: Recovery code preview TTL reduced to 5 minutes
- Fixed: Network admin settings page now saves correctly
"
+ "changelog": "
1.0.0 - 2026-06-05
- Fixed: Enable 2FA toggle defaults to email on first activation
- Fixed: QR code now displays correctly in user profiles
- Fixed: Resend link shows 60-second countdown
- Changed: Recovery codes redesigned as plain list
- Changed: Login links now vertical list
"
},
"banners": {
"low": "",
diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php
index e12552c..e956584 100644
--- a/vendor/composer/installed.php
+++ b/vendor/composer/installed.php
@@ -1,9 +1,9 @@
array(
'name' => 'robotstxt/robotstxt-2fa',
- 'pretty_version' => '1.0.0+no-version-set',
- 'version' => '1.0.0.0',
- 'reference' => null,
+ 'pretty_version' => 'dev-main',
+ 'version' => 'dev-main',
+ 'reference' => '4ff3019f7db5f58be0ecb3a3f1bb97bd97bdd153',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -29,9 +29,9 @@
'dev_requirement' => false,
),
'robotstxt/robotstxt-2fa' => array(
- 'pretty_version' => '1.0.0+no-version-set',
- 'version' => '1.0.0.0',
- 'reference' => null,
+ 'pretty_version' => 'dev-main',
+ 'version' => 'dev-main',
+ 'reference' => '4ff3019f7db5f58be0ecb3a3f1bb97bd97bdd153',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),