Skip to content

Commit 4c7aff6

Browse files
committed
feat: add anonymous user check to signup route
Prevent authenticated users from accessing the signup page by adding a requireAnonymous check in the loader
1 parent 3d18033 commit 4c7aff6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/routes/_auth+/signup.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { z } from 'zod'
88
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
99
import { ErrorList, Field } from '#app/components/forms.tsx'
1010
import { StatusButton } from '#app/components/ui/status-button.tsx'
11+
import { requireAnonymous } from '#app/utils/auth.server.ts'
1112
import {
1213
ProviderConnectionForm,
1314
providerNames,
@@ -28,6 +29,11 @@ const SignupSchema = z.object({
2829
email: EmailSchema,
2930
})
3031

32+
export async function loader({ request }: Route.LoaderArgs) {
33+
await requireAnonymous(request)
34+
return null
35+
}
36+
3137
export async function action({ request }: Route.ActionArgs) {
3238
const formData = await request.formData()
3339

0 commit comments

Comments
 (0)