Skip to content

Commit

Permalink
Move the fieldset logic to the caller where we know the state
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparsd committed Feb 14, 2025
1 parent e810859 commit 63323e4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions class-two-factor-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -1879,11 +1879,15 @@ public static function user_two_factor_options( $user ) {
</div>
<?php endforeach; ?>

<fieldset id="two-factor-options" <?php echo $show_2fa_options ? '' : 'disabled="disabled"'; ?>>
<?php
if ( $providers ) {
self::render_user_providers_form( $user, $providers );
}
?>
</fieldset>

<?php
/**
* Fires after the Two Factor methods table.
*
Expand All @@ -1906,7 +1910,6 @@ private static function render_user_providers_form( $user, $providers ) {
<?php esc_html_e( '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' ); ?>
</p>

<fieldset id="two-factor-options" <?php echo $show_2fa_options ? '' : 'disabled="disabled"'; ?>>
<?php wp_nonce_field( 'user_two_factor_options', '_nonce_user_two_factor_options', false ); ?>
<input type="hidden" name="<?php echo esc_attr( self::ENABLED_PROVIDERS_USER_META_KEY ); ?>[]" value="<?php /* Dummy input so $_POST value is passed when no providers are enabled. */ ?>" />

Expand Down Expand Up @@ -1957,7 +1960,6 @@ private static function render_user_providers_form( $user, $providers ) {
</tr>
</tbody>
</table>
</fieldset>
<?php
}

Expand Down

0 comments on commit 63323e4

Please sign in to comment.