PluginProbe ʕ •ᴥ•ʔ
WP 2FA – Two-factor authentication for WordPress / 4.0.0
WP 2FA – Two-factor authentication for WordPress v4.0.0
4.0.0 1.7.1 2.0.0 2.0.1 2.1.0 2.2.0 2.2.1 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.8.0 2.9.0 2.9.1 2.9.2 2.9.3 3.0.0 3.0.1 3.1.0 3.1.1 3.1.1.2 trunk 1.2.0 1.3.0 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.6.2 1.7.0
wp-2fa / templates / profile / main.php
wp-2fa / templates / profile Last commit date
admin-actions.php 1 day ago backup-codes-dialog.php 1 day ago card-backup.php 1 day ago card-setup.php 1 day ago confirm-dialogs.php 1 day ago index.php 1 day ago main.php 1 day ago summary.php 1 day ago totp-details.php 1 day ago
main.php
113 lines
1 <?php
2 /**
3 * Profile section: Main wrapper template.
4 *
5 * Renders the entire "Two-factor authentication settings" profile section.
6 * All variables are extracted from the $data array passed by the renderer.
7 *
8 * @var string $preamble_title Section heading.
9 * @var string $preamble_desc Section description.
10 * @var bool $show_preamble Whether to show the heading/description.
11 * @var bool $is_excluded Whether the user is excluded from 2FA.
12 * @var string $excluded_content Extra content for excluded users (from filter).
13 * @var bool $has_enabled_methods Whether the user has an enabled primary 2FA method.
14 * @var string $primary_label Translated label for the primary method.
15 * @var string $backup_methods_label Comma-separated backup method names.
16 * @var bool $show_enabled Whether to show the "Currently configured" summary.
17 * @var bool $show_setup_card Whether to show the 2FA Setup card.
18 * @var bool $show_backup_card Whether to show the Backup 2FA Method card.
19 * @var bool $show_admin_actions Whether to show admin-only actions.
20 * @var array $setup_card_data Data for the setup card template.
21 * @var array $backup_card_data Data for the backup card template.
22 * @var array $admin_actions_data Data for admin actions template.
23 * @var array $totp_data TOTP-specific data (QR code, key).
24 * @var string $extra_content Additional content from filters.
25 *
26 * @package wp2fa
27 * @since 4.0.0
28 */
29
30 defined( 'ABSPATH' ) || exit;
31 ?>
32 <div class="wp2fa-profile <?php echo \esc_attr( $data['styling_class'] ?? 'default_styling' ); ?>" id="wp2fa-profile-section" data-user-id="<?php echo \esc_attr( (string) $data['user_id'] ); ?>">
33
34 <?php if ( $data['show_preamble'] ) : ?>
35 <h2 class="wp2fa-profile__title"><?php echo \esc_html( strip_tags( $data['preamble_title'] ) ); ?></h2>
36 <?php if ( ! empty( $data['preamble_desc'] ) ) : ?>
37 <p class="wp2fa-profile__desc"><?php echo \wp_kses_post( $data['preamble_desc'] ); ?></p>
38 <?php endif; ?>
39 <?php endif; ?>
40
41 <?php if ( $data['is_excluded'] ) : ?>
42 <?php if ( ! empty( $data['excluded_content'] ) ) : ?>
43 <div class="wp2fa-profile__notice">
44 <?php echo \wp_kses_post( $data['excluded_content'] ); ?>
45 </div>
46 <?php endif; ?>
47
48 <?php
49 // Still render extra content (e.g. passkeys) for excluded users if applicable.
50 if ( ! empty( $data['extra_content'] ) ) :
51 echo \wp_kses_post( $data['extra_content'] );
52 endif;
53 ?>
54 </div>
55 <?php return; ?>
56 <?php endif; ?>
57
58 <?php
59 // Currently configured summary.
60 if ( $data['show_enabled'] ) :
61 include __DIR__ . '/summary.php';
62 endif;
63 ?>
64
65 <?php
66 // TOTP QR code section (only for users viewing own profile with TOTP configured).
67 if ( ! empty( $data['totp_data'] ) && $data['totp_data']['show_qr'] ) :
68 include __DIR__ . '/totp-details.php';
69 endif;
70 ?>
71
72 <?php if ( $data['show_setup_card'] || $data['show_backup_card'] ) : ?>
73 <h3 class="wp2fa-profile__section-title"><?php \esc_html_e( '2FA Configuration', 'wp-2fa' ); ?></h3>
74 <div class="wp2fa-profile__cards">
75 <?php
76 if ( $data['show_setup_card'] ) :
77 include __DIR__ . '/card-setup.php';
78 endif;
79
80 if ( $data['show_backup_card'] ) :
81 include __DIR__ . '/card-backup.php';
82 endif;
83 ?>
84 </div>
85 <?php endif; ?>
86
87 <?php
88 // Admin-only actions (reset, temp remove, unlock).
89 if ( $data['show_admin_actions'] ) :
90 include __DIR__ . '/admin-actions.php';
91 endif;
92 ?>
93
94 <?php
95 // Extra content from filters.
96 if ( ! empty( $data['extra_content'] ) ) :
97 echo \wp_kses_post( $data['extra_content'] );
98 endif;
99 ?>
100
101 <?php
102 // Confirmation dialogs.
103 include __DIR__ . '/confirm-dialogs.php';
104 ?>
105
106 <?php
107 // Backup codes generated dialog.
108 if ( ! empty( $data['backup_card_data']['show_generate_codes'] ) ) :
109 include __DIR__ . '/backup-codes-dialog.php';
110 endif;
111 ?>
112 </div>
113