import React, { useState } from "react"; import { useNavigate } from "react-router-dom"; import { Container, Title, Text, Button, Stack, Paper, Alert, Center, ThemeIcon, } from "@mantine/core"; import { IconShieldCheck, IconAlertCircle } from "@tabler/icons-react"; import { useTranslation } from "react-i18next"; import APP_ROUTE from "@/lib/app-route"; import { MfaSetupModal } from "@/ee/mfa"; import classes from "@/features/auth/components/auth.module.css"; import { notifications } from "@mantine/notifications"; import { useMfaPageProtection } from "@/ee/mfa"; export function MfaSetupRequiredPage() { const { t } = useTranslation(); const navigate = useNavigate(); const [setupModalOpen, setSetupModalOpen] = useState(false); const { isValid } = useMfaPageProtection(); const handleSetupComplete = async () => { setSetupModalOpen(false); notifications.show({ title: t("Success"), message: t( "Two-factor authentication has been set up. Please log in again.", ), }); navigate(APP_ROUTE.AUTH.LOGIN); }; const handleLogout = () => { navigate(APP_ROUTE.AUTH.LOGIN); }; if (!isValid) { return null; } return (
{t("Two-factor authentication required")} {t( "Your workspace requires two-factor authentication for all users", )} } color="blue" variant="light" w="100%" > {t( "To continue accessing your workspace, you must set up two-factor authentication. This adds an extra layer of security to your account.", )}
setSetupModalOpen(false)} onComplete={handleSetupComplete} isRequired={true} />
); }