diff --git a/apps/web/lib/signup/getServerSideProps.tsx b/apps/web/lib/signup/getServerSideProps.tsx index d3d2804349..64cd1c06a6 100644 --- a/apps/web/lib/signup/getServerSideProps.tsx +++ b/apps/web/lib/signup/getServerSideProps.tsx @@ -49,9 +49,6 @@ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => { emailVerificationEnabled, }; - // username + email prepopulated from query params - const { username: preFillusername, email: prefilEmail } = querySchema.parse(ctx.query); - if ((process.env.NEXT_PUBLIC_DISABLE_SIGNUP === "true" && !token) || signupDisabled) { return { redirect: { @@ -63,13 +60,15 @@ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => { // no token given, treat as a normal signup without verification token if (!token) { + // username + email prepopulated from query params + const queryData = querySchema.safeParse(ctx.query); return { props: JSON.parse( JSON.stringify({ ...props, prepopulateFormValues: { - username: preFillusername || null, - email: prefilEmail || null, + username: queryData.success ? queryData.data.username : null, + email: queryData.success ? queryData.data.email : null, }, }) ),