mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 22:53:08 +08:00
53132acb0a
* fix: redirect to original page after re-authentication When a session expires, the current URL is now preserved as a query parameter on the login page. After successful login (including MFA flows), the user is redirected back to their original page instead of always landing on /home. * secure --------- Co-authored-by: Julien Fontanet <julien.fontanet@isonoe.net>
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import React from "react";
|
|
import { Container, Paper, Title, Text, Alert, Stack } from "@mantine/core";
|
|
import { IconAlertCircle } from "@tabler/icons-react";
|
|
import { useTranslation } from "react-i18next";
|
|
import { MfaSetupModal } from "@/ee/mfa";
|
|
import APP_ROUTE, { getPostLoginRedirect } from "@/lib/app-route.ts";
|
|
import { useNavigate } from "react-router-dom";
|
|
|
|
export default function MfaSetupRequired() {
|
|
const { t } = useTranslation();
|
|
const navigate = useNavigate();
|
|
|
|
const handleSetupComplete = () => {
|
|
navigate(getPostLoginRedirect());
|
|
};
|
|
|
|
return (
|
|
<Container size="sm" py="xl">
|
|
<Paper shadow="sm" p="xl" radius="md" withBorder>
|
|
<Stack>
|
|
<Title order={2} ta="center">
|
|
{t("Two-factor authentication required")}
|
|
</Title>
|
|
|
|
<Alert icon={<IconAlertCircle size="1rem" />} color="yellow">
|
|
<Text size="sm">
|
|
{t(
|
|
"Your workspace requires two-factor authentication. Please set it up to continue.",
|
|
)}
|
|
</Text>
|
|
</Alert>
|
|
|
|
<Text c="dimmed" size="sm" ta="center">
|
|
{t(
|
|
"This adds an extra layer of security to your account by requiring a verification code from your authenticator app.",
|
|
)}
|
|
</Text>
|
|
|
|
<MfaSetupModal
|
|
opened={true}
|
|
onComplete={handleSetupComplete}
|
|
isRequired={true}
|
|
/>
|
|
</Stack>
|
|
</Paper>
|
|
</Container>
|
|
);
|
|
}
|