Scheduling infrastructure for absolutely everyone.
fix: safe-parse query schema in signup page to avoid zod throw (#18927)
Benny Joof2d12a4c214e
diff --git a/apps/web/lib/signup/getServerSideProps.tsx b/apps/web/lib/signup/getServerSideProps.tsxindex d3d28043495..64cd1c06a65 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 tokenif (!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,},})),