Skip to content

Commit

Permalink
🐛 Use current origin as base url for code verification (#925)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukevella authored Oct 30, 2023
1 parent 1b5543d commit faaf21c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/web/src/components/auth/auth-forms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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);

Expand Down Expand Up @@ -159,7 +162,7 @@ export const LoginForm: React.FunctionComponent<{
});
}
posthog?.capture("login", {
method: "verification-code"
method: "verification-code",
});
router.push(callbackUrl);
}
Expand Down

1 comment on commit faaf21c

@vercel
Copy link

@vercel vercel bot commented on faaf21c Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

app – ./

app-rallly.vercel.app
app.rallly.co
rallly-vert.vercel.app
app-git-main-rallly.vercel.app

Please sign in to comment.