fix: only show 2fa when available

This commit is contained in:
KernelDeimos 2024-08-18 00:41:39 -04:00 committed by Eric Dubé
parent 6e325fa000
commit 9fa12d43fc
2 changed files with 5 additions and 3 deletions

View File

@ -47,7 +47,8 @@ const WHOAMI_GET = eggspress('/whoami', {
uuid: req.user.uuid,
email: req.user.email,
unconfirmed_email: req.user.email,
email_confirmed: req.user.email_confirmed,
email_confirmed: req.user.email_confirmed
|| req.user.username === 'admin',
requires_email_confirmation: req.user.requires_email_confirmation,
desktop_bg_url: req.user.desktop_bg_url,
desktop_bg_color: req.user.desktop_bg_color,
@ -168,7 +169,8 @@ WHOAMI_POST.post('/whoami', auth, fs, express.json(), async (req, response, next
username: req.user.username,
uuid: req.user.uuid,
email: req.user.email,
email_confirmed: req.user.email_confirmed,
email_confirmed: req.user.email_confirmed
|| req.user.username === 'admin',
requires_email_confirmation: req.user.requires_email_confirmation,
desktop_bg_url: req.user.desktop_bg_url,
desktop_bg_color: req.user.desktop_bg_color,

View File

@ -53,7 +53,7 @@ export default {
h += `</div>`;
// configure 2FA
if(!user.is_temp){
if(!user.is_temp && user.email_confirmed){
h += `<div class="settings-card settings-card-security ${user.otp ? 'settings-card-success' : 'settings-card-warning'}">`;
h += `<div>`;
h += `<strong style="display:block;">${i18n('two_factor')}</strong>`;