From 9fa12d43fc782d7e4d2584b1cf74dca13b7ced25 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Sun, 18 Aug 2024 00:41:39 -0400 Subject: [PATCH] fix: only show 2fa when available --- src/backend/src/routers/whoami.js | 6 ++++-- src/gui/src/UI/Settings/UITabSecurity.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/backend/src/routers/whoami.js b/src/backend/src/routers/whoami.js index 89320312..a4eabdea 100644 --- a/src/backend/src/routers/whoami.js +++ b/src/backend/src/routers/whoami.js @@ -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, diff --git a/src/gui/src/UI/Settings/UITabSecurity.js b/src/gui/src/UI/Settings/UITabSecurity.js index 89ef589b..9ddda082 100644 --- a/src/gui/src/UI/Settings/UITabSecurity.js +++ b/src/gui/src/UI/Settings/UITabSecurity.js @@ -53,7 +53,7 @@ export default { h += ``; // configure 2FA - if(!user.is_temp){ + if(!user.is_temp && user.email_confirmed){ h += `
`; h += `
`; h += `${i18n('two_factor')}`;