diff --git a/apps/web/pages/auth/login.tsx b/apps/web/pages/auth/login.tsx index 032289bfe6..ca4e752e72 100644 --- a/apps/web/pages/auth/login.tsx +++ b/apps/web/pages/auth/login.tsx @@ -52,8 +52,6 @@ export default function Login({ totpEmail, }: inferSSRProps & WithNonceProps) { const searchParams = useSearchParams(); - const isTeamInvite = searchParams.get("teamInvite"); - const { t } = useLocale(); const router = useRouter(); const formSchema = z @@ -97,9 +95,7 @@ export default function Login({ callbackUrl = safeCallbackUrl || ""; const LoginFooter = ( - + {t("dont_have_an_account")} ); @@ -188,9 +184,6 @@ export default function Login({ ? LoginFooter : null }> - {isTeamInvite && ( - - )}
diff --git a/apps/web/pages/signup.tsx b/apps/web/pages/signup.tsx index 105e06e06b..104bed819e 100644 --- a/apps/web/pages/signup.tsx +++ b/apps/web/pages/signup.tsx @@ -13,7 +13,6 @@ import { isSAMLLoginEnabled } from "@calcom/features/ee/sso/lib/saml"; import { useFlagMap } from "@calcom/features/flags/context/provider"; import { getFeatureFlagMap } from "@calcom/features/flags/server/utils"; import { IS_SELF_HOSTED, WEBAPP_URL } from "@calcom/lib/constants"; -import { getSafeRedirectUrl } from "@calcom/lib/getSafeRedirectUrl"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import slugify from "@calcom/lib/slugify"; import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry"; @@ -35,23 +34,6 @@ type FormValues = z.infer; type SignupProps = inferSSRProps; -const getSafeCallbackUrl = (url: string | null) => { - if (!url) return null; - - let callbackUrl = url; - - if (/"\//.test(callbackUrl)) callbackUrl = callbackUrl.substring(1); - - // If not absolute URL, make it absolute - if (!/^https?:\/\//.test(callbackUrl)) { - callbackUrl = `${WEBAPP_URL}/${callbackUrl}`; - } - - const safeCallbackUrl = getSafeRedirectUrl(callbackUrl); - - return safeCallbackUrl; -}; - export default function Signup({ prepopulateFormValues, token, orgSlug }: SignupProps) { const searchParams = useSearchParams(); const telemetry = useTelemetry(); @@ -73,7 +55,6 @@ export default function Signup({ prepopulateFormValues, token, orgSlug }: Signup throw new Error(err.message); } }; - const callbackUrl = getSafeCallbackUrl(searchParams.get("callbackUrl")); const signUp: SubmitHandler = async (data) => { await fetch("/api/auth/signup", { @@ -91,10 +72,13 @@ export default function Signup({ prepopulateFormValues, token, orgSlug }: Signup .then(async () => { telemetry.event(telemetryEventTypes.signup, collectPageParameters()); const verifyOrGettingStarted = flags["email-verification"] ? "auth/verify-email" : "getting-started"; - await signIn<"credentials">("credentials", { ...data, - callbackUrl: `${callbackUrl ? callbackUrl : `${WEBAPP_URL}/${verifyOrGettingStarted}`}?from=signup`, + callbackUrl: `${ + searchParams?.get("callbackUrl") + ? `${WEBAPP_URL}/${searchParams.get("callbackUrl")}` + : `${WEBAPP_URL}/${verifyOrGettingStarted}` + }?from=signup`, }); }) .catch((err) => { @@ -173,7 +157,9 @@ export default function Signup({ prepopulateFormValues, token, orgSlug }: Signup className="w-full justify-center" onClick={() => signIn("Cal.com", { - callbackUrl: callbackUrl ? callbackUrl : `${WEBAPP_URL}/getting-started`, + callbackUrl: searchParams?.get("callbackUrl") + ? `${WEBAPP_URL}/${searchParams.get("callbackUrl")}` + : `${WEBAPP_URL}/getting-started`, }) }> {t("login_instead")} diff --git a/apps/web/pages/teams/index.tsx b/apps/web/pages/teams/index.tsx index 892e1bfedb..392c54f59e 100644 --- a/apps/web/pages/teams/index.tsx +++ b/apps/web/pages/teams/index.tsx @@ -1,11 +1,9 @@ import type { GetServerSidePropsContext } from "next"; import { getLayout } from "@calcom/features/MainLayout"; -import { getServerSession } from "@calcom/features/auth/lib/getServerSession"; import { TeamsListing } from "@calcom/features/ee/teams/components"; import { ShellMain } from "@calcom/features/shell/Shell"; import { WEBAPP_URL } from "@calcom/lib/constants"; -import { getSafeRedirectUrl } from "@calcom/lib/getSafeRedirectUrl"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui"; @@ -43,21 +41,6 @@ function Teams() { export const getServerSideProps = async (context: GetServerSidePropsContext) => { const ssr = await ssrInit(context); await ssr.viewer.me.prefetch(); - const session = await getServerSession({ req: context.req, res: context.res }); - const token = context.query?.token; - const resolvedUrl = context.resolvedUrl; - - const callbackUrl = token ? getSafeRedirectUrl(`${WEBAPP_URL}${resolvedUrl}`) : null; - - if (!session) { - return { - redirect: { - destination: callbackUrl ? `/auth/login?callbackUrl=${callbackUrl}&teamInvite=true` : "/auth/login", - permanent: false, - }, - props: {}, - }; - } return { props: { trpcState: ssr.dehydrate() } }; }; diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 205efc742f..478d87fdfc 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -45,7 +45,6 @@ "invite_team_individual_segment": "Invite individual", "invite_team_bulk_segment": "Bulk import", "invite_team_notifcation_badge": "Inv.", - "signin_or_signup_to_accept_invite": "You need to Sign in or Sign up to see team invitation.", "your_event_has_been_scheduled": "Your event has been scheduled", "your_event_has_been_scheduled_recurring": "Your recurring event has been scheduled", "accept_our_license": "Accept our license by changing the .env variable <1>NEXT_PUBLIC_LICENSE_CONSENT to '{{agree}}'.",