aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/app/signup/page.tsx
blob: 5c8b943e7c54aa9b350f97f0174dbade1eefb23a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { redirect } from "next/dist/client/components/navigation";
import KarakeepLogo from "@/components/KarakeepIcon";
import SignUpForm from "@/components/signup/SignUpForm";
import { getServerAuthSession } from "@/server/auth";

import { validateRedirectUrl } from "@karakeep/shared/utils/redirectUrl";

export default async function SignUpPage({
  searchParams,
}: {
  searchParams: Promise<{ redirectUrl?: string }>;
}) {
  const session = await getServerAuthSession();
  const { redirectUrl: rawRedirectUrl } = await searchParams;
  const redirectUrl = validateRedirectUrl(rawRedirectUrl) ?? "/";

  if (session) {
    redirect(redirectUrl);
  }

  return (
    <div className="flex min-h-screen items-center justify-center bg-background px-4 py-12 sm:px-6 lg:px-8">
      <div className="w-full max-w-md space-y-8">
        <div className="flex items-center justify-center">
          <KarakeepLogo height={80} />
        </div>
        <SignUpForm redirectUrl={redirectUrl} />
      </div>
    </div>
  );
}