From 02fe6d217ad7a80289ca7cd73567fb6df425f78e Mon Sep 17 00:00:00 2001 From: Richard Bergsma Date: Sat, 7 Jun 2025 00:29:49 +0200 Subject: [PATCH] Add CSRF token handling to contact form for enhanced security - Introduce a hidden CSRF token input field in the contact form. - Implement a function to fetch and set the CSRF token on form load. - Update form submission logic to use FormData and re-fetch the CSRF token after successful submission. --- src/components/ui/Form.astro | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/components/ui/Form.astro b/src/components/ui/Form.astro index 0447375..a393ae0 100644 --- a/src/components/ui/Form.astro +++ b/src/components/ui/Form.astro @@ -36,6 +36,9 @@ const { inputs, textarea, disclaimer, button = 'Contact us', description = '' } + + +