From 240bcce33468684236968c20acc53166e7298afe Mon Sep 17 00:00:00 2001 From: Kaspars Dambis Date: Thu, 19 Sep 2024 12:40:12 +0300 Subject: [PATCH] Add notices --- class-two-factor-core.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/class-two-factor-core.php b/class-two-factor-core.php index 99033a70..eebce9c4 100644 --- a/class-two-factor-core.php +++ b/class-two-factor-core.php @@ -1821,9 +1821,21 @@ public static function user_two_factor_options( $user ) { $show_2fa_options ? '' : 'disabled="disabled"' ); - wp_nonce_field( 'user_two_factor_options', '_nonce_user_two_factor_options', false ); + $notices = []; + if ( empty( $enabled_providers ) ) { + $notices[] = __( 'Configure a primary two-factor method along with a backup method, such as Recovery Codes, to avoid being locked out if you lose access to your primary method.', 'two-factor' ); + } elseif ( 1 === count( $enabled_providers ) ) { + $notices['warning'] = __( 'To prevent being locked out of your account, consider enabling a backup method like Recovery Codes in case you lose access to your primary authentication method.', 'two-factor' ); + } + ?>

+ $notice ) : ?> +
+

+
+ +