diff --git a/www/admin.php b/www/admin.php index 29629bb..2ddc748 100644 --- a/www/admin.php +++ b/www/admin.php @@ -684,7 +684,6 @@ function send_edit_admin(): void

<?php echo htmlspecialchars(_('TOTP setup QR code')); ?>

-

diff --git a/www/manage_account.php b/www/manage_account.php index 60a7b6a..d654b7d 100644 --- a/www/manage_account.php +++ b/www/manage_account.php @@ -196,6 +196,10 @@ if ( $_SERVER[ 'REQUEST_METHOD' ] === 'POST' ) { $stmt->execute( [ $_SESSION[ 'email_user' ] ] ); $msg .= '

'.htmlspecialchars(_('Successfully enabled 2FA')).'

'; } + } elseif ( $_POST[ 'action' ] === 'disable_pgp_2fa' && ! empty( $_SESSION[ 'email_user' ] ) ) { + $stmt = $db->prepare( 'UPDATE mailbox SET tfa = 0 WHERE username = ? AND active = 1;' ); + $stmt->execute( [ $_SESSION[ 'email_user' ] ] ); + $msg .= '

'.htmlspecialchars(_('Successfully disabled two-factor authentication')).'

'; } elseif ( $_POST[ 'action' ] === 'start_totp_setup' && ! empty( $_SESSION[ 'email_user' ] ) ) { $_SESSION[ 'user_totp_setup' ] = generate_totp_secret(); } elseif ( $_POST[ 'action' ] === 'enable_totp' && ! empty( $_SESSION[ 'email_user' ] ) && ! empty( $_SESSION[ 'user_totp_setup' ] ) ) { @@ -423,7 +427,6 @@ if ( empty( $_SESSION[ 'email_user' ] ) ) { ?>

<?php echo htmlspecialchars(_('TOTP setup QR code')); ?>

-

@@ -439,8 +442,13 @@ if ( empty( $_SESSION[ 'email_user' ] ) ) { ?> '.htmlspecialchars(_('Yay, PGP based 2FA is enabled!')).'

'; + if ( (int) $pgp_status[ 'tfa' ] === 1 ) { + ?> +
+ + +
+