diff --git a/class-two-factor-core.php b/class-two-factor-core.php index 99033a70..f0204378 100644 --- a/class-two-factor-core.php +++ b/class-two-factor-core.php @@ -1788,6 +1788,8 @@ public static function manage_users_custom_column( $output, $column_name, $user_ * @param WP_User $user WP_User object of the logged-in user. */ public static function user_two_factor_options( $user ) { + $notices = []; + wp_enqueue_style( 'user-edit-2fa', plugins_url( 'user-edit.css', __FILE__ ), array(), TWO_FACTOR_VERSION ); $enabled_providers = array_keys( self::get_available_providers_for_user( $user ) ); @@ -1803,16 +1805,16 @@ public static function user_two_factor_options( $user ) { $show_2fa_options = self::current_user_can_update_two_factor_options(); if ( ! $show_2fa_options ) { - $url = self::get_user_two_factor_revalidate_url(); - $url = add_query_arg( 'redirect_to', urlencode( self::get_user_settings_page_url( $user->ID ) . '#two-factor-options' ), $url ); + $url = add_query_arg( + 'redirect_to', + urlencode( self::get_user_settings_page_url( $user->ID ) . '#two-factor-options' ), + self::get_user_two_factor_revalidate_url() + ); - printf( - '

%s

', - sprintf( - __( 'To update your Two-Factor options, you must first revalidate your session.', 'two-factor' ) . - '
' . __( 'Revalidate now', 'two-factor' ) . '', + $notices['warning two-factor-warning-revalidate-session'] = sprintf( + esc_html__( 'To update your Two-Factor options, you must first revalidate your session.', 'two-factor' ) . + ' ' . esc_html__( 'Revalidate now', 'two-factor' ) . '', esc_url( $url ) - ) ); } @@ -1821,9 +1823,20 @@ 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 ); + if ( 1 === count( $enabled_providers ) ) { + $notices['warning two-factor-warning-suggest-backup'] = esc_html__( '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 ) : ?> +
+

+
+ +

+ +

+