build ok,
This commit is contained in:
15
002_source/cms/src/app/auth/cognito/layout.tsx
Normal file
15
002_source/cms/src/app/auth/cognito/layout.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { AuthStrategy } from '@/lib/auth/strategy';
|
||||
import { StrategyGuard } from '@/components/auth/strategy-guard';
|
||||
|
||||
// We are not adding the auth check because there might be individual pages that require the user to be authenticated.
|
||||
// Another reason is that layouts get cached and loaded only once for all children.
|
||||
|
||||
interface LayoutProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export default function Layout({ children }: LayoutProps): React.JSX.Element {
|
||||
return <StrategyGuard expected={AuthStrategy.COGNITO}>{children}</StrategyGuard>;
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
import * as React from 'react';
|
||||
import type { Metadata } from 'next';
|
||||
|
||||
import { config } from '@/config';
|
||||
import { NewPasswordRequiredForm } from '@/components/auth/cognito/new-password-required-form';
|
||||
import { GuestGuard } from '@/components/auth/guest-guard';
|
||||
import { SplitLayout } from '@/components/auth/split-layout';
|
||||
|
||||
export const metadata: Metadata = { title: `New password required | Cognito | Auth | ${config.site.name}` };
|
||||
|
||||
export default function Page(): React.JSX.Element {
|
||||
return (
|
||||
<GuestGuard>
|
||||
<SplitLayout>
|
||||
<NewPasswordRequiredForm />
|
||||
</SplitLayout>
|
||||
</GuestGuard>
|
||||
);
|
||||
}
|
19
002_source/cms/src/app/auth/cognito/reset-password/page.tsx
Normal file
19
002_source/cms/src/app/auth/cognito/reset-password/page.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import * as React from 'react';
|
||||
import type { Metadata } from 'next';
|
||||
|
||||
import { config } from '@/config';
|
||||
import { ResetPasswordForm } from '@/components/auth/cognito/reset-password-form';
|
||||
import { GuestGuard } from '@/components/auth/guest-guard';
|
||||
import { SplitLayout } from '@/components/auth/split-layout';
|
||||
|
||||
export const metadata: Metadata = { title: `Reset password | Cognito | Auth | ${config.site.name}` };
|
||||
|
||||
export default function Page(): React.JSX.Element {
|
||||
return (
|
||||
<GuestGuard>
|
||||
<SplitLayout>
|
||||
<ResetPasswordForm />
|
||||
</SplitLayout>
|
||||
</GuestGuard>
|
||||
);
|
||||
}
|
19
002_source/cms/src/app/auth/cognito/sign-in/page.tsx
Normal file
19
002_source/cms/src/app/auth/cognito/sign-in/page.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import * as React from 'react';
|
||||
import type { Metadata } from 'next';
|
||||
|
||||
import { config } from '@/config';
|
||||
import { SignInForm } from '@/components/auth/cognito/sign-in-form';
|
||||
import { GuestGuard } from '@/components/auth/guest-guard';
|
||||
import { SplitLayout } from '@/components/auth/split-layout';
|
||||
|
||||
export const metadata: Metadata = { title: `Sign in | Cognito | Auth | ${config.site.name}` };
|
||||
|
||||
export default function Page(): React.JSX.Element {
|
||||
return (
|
||||
<GuestGuard>
|
||||
<SplitLayout>
|
||||
<SignInForm />
|
||||
</SplitLayout>
|
||||
</GuestGuard>
|
||||
);
|
||||
}
|
35
002_source/cms/src/app/auth/cognito/sign-up-confirm/page.tsx
Normal file
35
002_source/cms/src/app/auth/cognito/sign-up-confirm/page.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import * as React from 'react';
|
||||
import type { Metadata } from 'next';
|
||||
import Alert from '@mui/material/Alert';
|
||||
import Box from '@mui/material/Box';
|
||||
|
||||
import { config } from '@/config';
|
||||
import { SignUpConfirmForm } from '@/components/auth/cognito/sign-up-confirm-form';
|
||||
import { GuestGuard } from '@/components/auth/guest-guard';
|
||||
import { SplitLayout } from '@/components/auth/split-layout';
|
||||
|
||||
export const metadata: Metadata = { title: `Sign up confirm | Cognito | Auth | ${config.site.name}` };
|
||||
|
||||
interface PageProps {
|
||||
searchParams: { email?: string };
|
||||
}
|
||||
|
||||
export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
||||
const { email } = searchParams;
|
||||
|
||||
if (!email) {
|
||||
return (
|
||||
<Box sx={{ p: 3 }}>
|
||||
<Alert color="error">Email is required</Alert>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<GuestGuard>
|
||||
<SplitLayout>
|
||||
<SignUpConfirmForm email={email} />
|
||||
</SplitLayout>
|
||||
</GuestGuard>
|
||||
);
|
||||
}
|
19
002_source/cms/src/app/auth/cognito/sign-up/page.tsx
Normal file
19
002_source/cms/src/app/auth/cognito/sign-up/page.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import * as React from 'react';
|
||||
import type { Metadata } from 'next';
|
||||
|
||||
import { config } from '@/config';
|
||||
import { SignUpForm } from '@/components/auth/cognito/sign-up-form';
|
||||
import { GuestGuard } from '@/components/auth/guest-guard';
|
||||
import { SplitLayout } from '@/components/auth/split-layout';
|
||||
|
||||
export const metadata: Metadata = { title: `Sign up | Cognito | Auth | ${config.site.name}` };
|
||||
|
||||
export default function Page(): React.JSX.Element {
|
||||
return (
|
||||
<GuestGuard>
|
||||
<SplitLayout>
|
||||
<SignUpForm />
|
||||
</SplitLayout>
|
||||
</GuestGuard>
|
||||
);
|
||||
}
|
35
002_source/cms/src/app/auth/cognito/update-password/page.tsx
Normal file
35
002_source/cms/src/app/auth/cognito/update-password/page.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import * as React from 'react';
|
||||
import type { Metadata } from 'next';
|
||||
import Alert from '@mui/material/Alert';
|
||||
import Box from '@mui/material/Box';
|
||||
|
||||
import { config } from '@/config';
|
||||
import { UpdatePasswordForm } from '@/components/auth/cognito/update-password-form';
|
||||
import { GuestGuard } from '@/components/auth/guest-guard';
|
||||
import { SplitLayout } from '@/components/auth/split-layout';
|
||||
|
||||
export const metadata: Metadata = { title: `Update password | Cognito | Auth | ${config.site.name}` };
|
||||
|
||||
interface PageProps {
|
||||
searchParams: { email?: string };
|
||||
}
|
||||
|
||||
export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
||||
const { email } = searchParams;
|
||||
|
||||
if (!email) {
|
||||
return (
|
||||
<Box sx={{ p: 3 }}>
|
||||
<Alert color="error">Email is required</Alert>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<GuestGuard>
|
||||
<SplitLayout>
|
||||
<UpdatePasswordForm email={email} />
|
||||
</SplitLayout>
|
||||
</GuestGuard>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user