🐛 (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

@@ -72,7 +72,7 @@
"micro-cors": "0.1.1",
"minio": "7.0.32",
"next": "13.2.4",
"next-auth": "4.20.1",
"next-auth": "4.19.2",
"@typebot.io/next-international": "0.3.8",
"nextjs-cors": "^2.1.2",
"nodemailer": "6.9.1",

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`)