diff --git a/src/lib/components/auth/MfaManagement.svelte b/src/lib/components/auth/MfaManagement.svelte
new file mode 100644
index 0000000000..8595d60887
--- /dev/null
+++ b/src/lib/components/auth/MfaManagement.svelte
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+ {#if 'challenge' in flow}
+
+ {:else if codes.length}
+
+ {:else if error}
+
{error}
+
+ {:else}
+
+
+ {$i18n.t('Loading...')}
+
+ {/if}
+
+
diff --git a/src/lib/components/chat/Settings/Account/Mfa.svelte b/src/lib/components/chat/Settings/Account/Mfa.svelte
index db7334d7fb..d9d428a1ad 100644
--- a/src/lib/components/chat/Settings/Account/Mfa.svelte
+++ b/src/lib/components/chat/Settings/Account/Mfa.svelte
@@ -1,13 +1,11 @@
- {#if codes.length}
-
- {:else if challenge}
-
- {
- challenge = null;
- }}
- />
-
- {:else if status}
+ {#if status}
{status.enabled
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 43dbde516b..4f0b5bb06e 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -79,6 +79,7 @@
import AppSidebar from '$lib/components/app/AppSidebar.svelte';
import SyncStatsModal from '$lib/components/chat/Settings/SyncStatsModal.svelte';
import Spinner from '$lib/components/common/Spinner.svelte';
+ import MfaManagement from '$lib/components/auth/MfaManagement.svelte';
import { getOutputText } from '$lib/components/chat/Messages/structuredOutput';
import { getUserSettings } from '$lib/apis/users';
import dayjs from 'dayjs';
@@ -101,13 +102,22 @@
// handle frontend updates (https://svelte.dev/docs/kit/configuration#version)
beforeNavigate(async ({ willUnload, to }) => {
- if (updated.current && !willUnload && to?.url) {
+ if (updated.current && !mfaManagement && !willUnload && to?.url) {
await unregisterServiceWorkers();
location.href = to.url.href;
}
});
setContext('i18n', i18n);
+ /** @type {import('$lib/components/auth/MfaManagement.svelte').MfaManagementFlow | null} */
+ let mfaManagement = null;
+ setContext(
+ 'showMfaManagement',
+ /** @param {import('$lib/components/auth/MfaManagement.svelte').MfaManagementFlow} flow */
+ (flow) => {
+ mfaManagement = flow;
+ }
+ );
const bc = new BroadcastChannel('active-tab-channel');
@@ -208,8 +218,9 @@
if (version !== null || deploymentId !== null) {
if (
- ($WEBUI_VERSION !== null && version !== $WEBUI_VERSION) ||
- ($WEBUI_DEPLOYMENT_ID !== null && deploymentId !== $WEBUI_DEPLOYMENT_ID)
+ !mfaManagement &&
+ (($WEBUI_VERSION !== null && version !== $WEBUI_VERSION) ||
+ ($WEBUI_DEPLOYMENT_ID !== null && deploymentId !== $WEBUI_DEPLOYMENT_ID))
) {
await unregisterServiceWorkers();
location.href = location.href;
@@ -1465,7 +1476,9 @@
{/if}
{#if loaded}
- {#if $isApp}
+ {#if mfaManagement}
+ (mfaManagement = null)} />
+ {:else if $isApp}