The update adds a rerouting functionality upon successful multi-factor authentication, replacing a console log action previously triggered upon success. The change enhances the authentication flow by redirecting users to a specified path upon validation. Additionally, minor refactorings are done such as replacing direct routing paths with path configs and adjusting import statements.
57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
import Link from 'next/link';
|
|
|
|
import { SignUpMethodsContainer } from '@kit/auth/sign-up';
|
|
import { Button } from '@kit/ui/button';
|
|
import { Heading } from '@kit/ui/heading';
|
|
import { Trans } from '@kit/ui/trans';
|
|
|
|
import authConfig from '~/config/auth.config';
|
|
import pathsConfig from '~/config/paths.config';
|
|
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
|
|
import { withI18n } from '~/lib/i18n/with-i18n';
|
|
|
|
export const generateMetadata = async () => {
|
|
const i18n = await createI18nServerInstance();
|
|
|
|
return {
|
|
title: i18n.t('auth:signUp'),
|
|
};
|
|
};
|
|
|
|
interface Props {
|
|
searchParams: {
|
|
invite_token?: string;
|
|
};
|
|
}
|
|
|
|
function SignUpPage({ searchParams }: Props) {
|
|
const inviteToken = searchParams.invite_token;
|
|
|
|
return (
|
|
<>
|
|
<Heading level={5}>
|
|
<Trans i18nKey={'auth:signUpHeading'} />
|
|
</Heading>
|
|
|
|
<SignUpMethodsContainer
|
|
providers={authConfig.providers}
|
|
paths={{
|
|
callback: pathsConfig.auth.callback,
|
|
appHome: pathsConfig.app.home,
|
|
}}
|
|
inviteToken={inviteToken}
|
|
/>
|
|
|
|
<div className={'justify-centers flex'}>
|
|
<Link href={pathsConfig.auth.signIn}>
|
|
<Button variant={'link'} size={'sm'}>
|
|
<Trans i18nKey={'auth:alreadyHaveAnAccount'} />
|
|
</Button>
|
|
</Link>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default withI18n(SignUpPage);
|