2
0

🐛 (auth) Fix invalid redirects to internal url

Closes #403
This commit is contained in:
Baptiste Arnaud
2023-03-29 08:14:35 +02:00
parent f13d7a1a5a
commit 4986ec79f5
3 changed files with 7 additions and 14 deletions

View File

@@ -2,18 +2,11 @@ import { sendMagicLinkEmail } from '@typebot.io/emails'
type Props = {
identifier: string
token: string
url: string
}
export const sendVerificationRequest = async ({ identifier, token }: Props) => {
export const sendVerificationRequest = async ({ identifier, url }: Props) => {
try {
const url = `${
process.env.NEXTAUTH_URL
}/api/auth/callback/email?${new URLSearchParams({
email: identifier,
token,
callbackUrl: `${process.env.NEXTAUTH_URL}/signin`,
}).toString()}`
await sendMagicLinkEmail({ url, to: identifier })
} catch (err) {
throw new Error(`Email(s) could not be sent`)