From 694e632815c2f9bb62da5bc9283e557675859124 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Thu, 7 Nov 2024 21:44:11 +0100 Subject: [PATCH] fix: don't send the CAPTCHA token in the email message plain text through contact form --- app/api/contact/route.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/api/contact/route.ts b/app/api/contact/route.ts index 389d6d0..af69e54 100644 --- a/app/api/contact/route.ts +++ b/app/api/contact/route.ts @@ -13,7 +13,9 @@ const generateEmailContent = (data: Record) => { const stringData = Object.entries(data).reduce( (str, [key, val]) => str + - `${CONTACT_MESSAGE_FIELDS[key] || key}: ${val.replace(/\n/g, "\n")} \n\n`, + (key == "captchaToken" + ? "" + : `${CONTACT_MESSAGE_FIELDS[key] || key}: ${val.replace(/\n/g, "\n")} \n\n`), "" );