From faaf21c08a5d4c0a266f726b35d2be1baa2d6d8c Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Mon, 30 Oct 2023 19:41:45 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Use=20current=20origin=20as=20ba?= =?UTF-8?q?se=20url=20for=20code=20verification=20(#925)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/components/auth/auth-forms.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/auth/auth-forms.tsx b/apps/web/src/components/auth/auth-forms.tsx index 63ac38b4d..192400f13 100644 --- a/apps/web/src/components/auth/auth-forms.tsx +++ b/apps/web/src/components/auth/auth-forms.tsx @@ -7,7 +7,6 @@ import React from "react"; import { useForm } from "react-hook-form"; import { createGlobalState } from "react-use"; -import { absoluteUrl } from "@/utils/absolute-url"; import { usePostHog } from "@/utils/posthog"; import { trpc } from "@/utils/trpc/client"; @@ -17,7 +16,11 @@ import { TextInput } from "../text-input"; export const useDefaultEmail = createGlobalState(""); const verifyCode = async (options: { email: string; token: string }) => { - const url = absoluteUrl("/api/auth/callback/email", options); + const url = `${ + window.location.origin + }/api/auth/callback/email?email=${encodeURIComponent(options.email)}&token=${ + options.token + }`; const res = await fetch(url); @@ -159,7 +162,7 @@ export const LoginForm: React.FunctionComponent<{ }); } posthog?.capture("login", { - method: "verification-code" + method: "verification-code", }); router.push(callbackUrl); }