Skip to content

Commit

Permalink
prevent randoms from signing up in the preview env
Browse files Browse the repository at this point in the history
  • Loading branch information
xvvvyz committed Oct 30, 2024
1 parent 464c69f commit 806645b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/(pages)/(auth)/sign-up/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import Button from '@/_components/button';
import SignUpForm from '@/_components/sign-up-form';
import { headers } from 'next/headers';
import { redirect } from 'next/navigation';

export const metadata = { title: 'Sign up' };

interface PageProps {
searchParams: Promise<{ next?: string }>;
searchParams: Promise<{ next?: string; test?: string }>;
}

const Page = async ({ searchParams }: PageProps) => {
const { next } = await searchParams;
const { next, test } = await searchParams;

// hack to keep randoms from signing up in the preview env
if (test !== 'yes' && (await headers()).get('host') !== 'llog.app') {
redirect('https://llog.app/sign-up');
}

return (
<>
Expand Down

0 comments on commit 806645b

Please sign in to comment.