Scheduling infrastructure for absolutely everyone.
Adds BASE_URL to callbackUrl in signup page and Shell component (#1882)
Agusti Fernandez373bc1660c58
diff --git a/apps/web/components/Shell.tsx b/apps/web/components/Shell.tsxindex 09400a850dc..e43864f80cf 100644--- a/apps/web/components/Shell.tsx+++ b/apps/web/components/Shell.tsx@@ -22,6 +22,7 @@ import TrialBanner from "@ee/components/TrialBanner";import HelpMenuItemDynamic from "@ee/lib/intercom/HelpMenuItemDynamic";import classNames from "@lib/classNames";+import { BASE_URL } from "@lib/config/constants";import { shouldShowOnboarding } from "@lib/getting-started";import { useLocale } from "@lib/hooks/useLocale";import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";@@ -61,7 +62,7 @@ function useRedirectToLoginIfUnauthenticated() {router.replace({pathname: "/auth/login",query: {- callbackUrl: `${location.pathname}${location.search}`,+ callbackUrl: `${BASE_URL}/${location.pathname}${location.search}`,},});}diff --git a/apps/web/pages/auth/signup.tsx b/apps/web/pages/auth/signup.tsxindex e7f89014444..f72775a89f8 100644--- a/apps/web/pages/auth/signup.tsx+++ b/apps/web/pages/auth/signup.tsx@@ -4,6 +4,7 @@ import { useRouter } from "next/router";import { FormProvider, SubmitHandler, useForm } from "react-hook-form";import { asStringOrNull } from "@lib/asStringOrNull";+import { BASE_URL } from "@lib/config/constants";import { useLocale } from "@lib/hooks/useLocale";import prisma from "@lib/prisma";import { isSAMLLoginEnabled } from "@lib/saml";@@ -56,7 +57,12 @@ export default function Signup({ email }: Props) {method: "POST",}).then(handleErrors)- .then(async () => await signIn("Cal.com", { callbackUrl: (router.query.callbackUrl || "") as string }))+ .then(+ async () =>+ await signIn("Cal.com", {+ callbackUrl: (`${BASE_URL}/${router.query.callbackUrl}` || "") as string,+ })+ ).catch((err) => {methods.setError("apiError", { message: err.message });});@@ -123,7 +129,9 @@ export default function Signup({ email }: Props) {color="secondary"className="w-5/12 justify-center"onClick={() =>- signIn("Cal.com", { callbackUrl: (router.query.callbackUrl || "") as string })+ signIn("Cal.com", {+ callbackUrl: (`${BASE_URL}/${router.query.callbackUrl}` || "") as string,+ })}>{t("login_instead")}</Button>@@ -176,7 +184,7 @@ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {return {redirect: {permanent: false,- destination: "/auth/login?callbackUrl=" + ctx.query.callbackUrl,+ destination: "/auth/login?callbackUrl=" + `${BASE_URL}/${ctx.query.callbackUrl}`,},};}