Scheduling infrastructure for absolutely everyone.
fix: use callback url in signup (#6010)
Udit Takkardf0a5226561e
diff --git a/apps/web/pages/signup.tsx b/apps/web/pages/signup.tsxindex 183fc9414cc..1b8c77623c3 100644--- a/apps/web/pages/signup.tsx+++ b/apps/web/pages/signup.tsx@@ -6,6 +6,7 @@ import { FormProvider, SubmitHandler, useForm } from "react-hook-form";import LicenseRequired from "@calcom/features/ee/common/components/v2/LicenseRequired";import { isSAMLLoginEnabled } from "@calcom/features/ee/sso/lib/saml";import { useLocale } from "@calcom/lib/hooks/useLocale";+import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";import { inferSSRProps } from "@calcom/types/inferSSRProps";import { Alert, Button, EmailField, PasswordField, TextField } from "@calcom/ui";import { HeadSeo } from "@calcom/web/components/seo/head-seo";@@ -26,6 +27,8 @@ type FormValues = {export default function Signup({ prepopulateFormValues }: inferSSRProps<typeof getServerSideProps>) {const { t } = useLocale();const router = useRouter();+ const telemetry = useTelemetry();+const methods = useForm<FormValues>({defaultValues: prepopulateFormValues,});@@ -53,8 +56,12 @@ export default function Signup({ prepopulateFormValues }: inferSSRProps<typeof g}).then(handleErrors).then(async () => {- await signIn("Cal.com", {- callbackUrl: router.query.callbackUrl ? `${WEBAPP_URL}/${router.query.callbackUrl}` : WEBAPP_URL,+ telemetry.event(telemetryEventTypes.login, collectPageParameters());+ await signIn<"credentials">("credentials", {+ ...data,+ callbackUrl: router.query.callbackUrl+ ? `${WEBAPP_URL}/${router.query.callbackUrl}`+ : `${WEBAPP_URL}/getting-started`,});}).catch((err) => {@@ -111,7 +118,9 @@ export default function Signup({ prepopulateFormValues }: inferSSRProps<typeof gclassName="w-5/12 justify-center"onClick={() =>signIn("Cal.com", {- callbackUrl: (`${WEBAPP_URL}/${router.query.callbackUrl}` || "") as string,+ callbackUrl: router.query.callbackUrl+ ? `${WEBAPP_URL}/${router.query.callbackUrl}`+ : `${WEBAPP_URL}/getting-started`,})}>{t("login_instead")}