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

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

8
pnpm-lock.yaml generated
View File

@@ -99,7 +99,7 @@ importers:
micro-cors: 0.1.1
minio: 7.0.32
next: 13.2.4
next-auth: 4.20.1
next-auth: 4.19.2
nextjs-cors: ^2.1.2
nodemailer: 6.9.1
nprogress: 0.2.0
@@ -184,7 +184,7 @@ importers:
micro-cors: 0.1.1
minio: 7.0.32
next: 13.2.4_6m24vuloj5ihw4zc5lbsktc4fu
next-auth: 4.20.1_3tbpwx46tlrk4rci3doelizria
next-auth: 4.19.2_3tbpwx46tlrk4rci3doelizria
nextjs-cors: 2.1.2_next@13.2.4
nodemailer: 6.9.1
nprogress: 0.2.0
@@ -15281,8 +15281,8 @@ packages:
/neo-async/2.6.2:
resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==}
/next-auth/4.20.1_3tbpwx46tlrk4rci3doelizria:
resolution: {integrity: sha512-ZcTUN4qzzZ/zJYgOW0hMXccpheWtAol8QOMdMts+LYRcsPGsqf2hEityyaKyECQVw1cWInb9dF3wYwI5GZdEmQ==}
/next-auth/4.19.2_3tbpwx46tlrk4rci3doelizria:
resolution: {integrity: sha512-6V2YG3IJQVhgCAH7mvT3yopTW92gMdUrcwGX7NQ0dCreT/+axGua/JmVdarjec0C/oJukKpIYRgjMlV+L5ZQOQ==}
peerDependencies:
next: ^12.2.5 || ^13
nodemailer: ^6.6.5