From 399f47c6c7785e0bec091003cd6b98363f40fd4f Mon Sep 17 00:00:00 2001 From: "Rudy B." Date: Fri, 24 Apr 2026 19:37:51 +0200 Subject: [PATCH] feat(2FA): enfore 2FA from App layout --- src/app/(main)/App.tsx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/app/(main)/App.tsx b/src/app/(main)/App.tsx index 2f85a86e4..0323ec052 100644 --- a/src/app/(main)/App.tsx +++ b/src/app/(main)/App.tsx @@ -5,7 +5,14 @@ import { useEffect } from 'react'; import { MobileNav } from '@/app/(main)/MobileNav'; import { SideNav } from '@/app/(main)/SideNav'; import { TopNav } from '@/app/(main)/TopNav'; -import { useConfig, useLoginQuery, useNavigation, useTeamQuery } from '@/components/hooks'; +import { + useConfig, + useLoginQuery, + useNavigation, + useTeamQuery, + useTwoFactorStatusQuery, +} from '@/components/hooks'; +import { TwoFactorSetupModal } from '@/components/modals/TwoFactorSetupModal'; import { LAST_TEAM_CONFIG } from '@/lib/constants'; import { removeItem, setItem } from '@/lib/storage'; import { UpdateNotice } from './UpdateNotice'; @@ -15,6 +22,8 @@ export function App({ children }) { const config = useConfig(); const { pathname, router, teamId } = useNavigation(); const { isLoading: isTeamLoading, error: teamError } = useTeamQuery(teamId); + const { data: twoFactorStatus } = useTwoFactorStatusQuery(!!user); + const needsTwoFactorSetup = !!(twoFactorStatus?.isRequired && !twoFactorStatus?.isEnabled); useEffect(() => { if (teamId) { @@ -64,8 +73,15 @@ export function App({ children }) { - {children} + + {children} + + {needsTwoFactorSetup && } {process.env.NODE_ENV === 'production' && !pathname.includes('/share/') && (