From 59aeab43a94250d7dc9e587a144a218cd3143d31 Mon Sep 17 00:00:00 2001 From: Blake Ridgway Date: Sat, 29 Nov 2025 20:52:46 -0600 Subject: [PATCH] add temp captcha to contact form --- go.mod | 1 + go.sum | 2 + internal/handlers/handlers.go | 3 +- templates/contact.html | 129 +++++++++++++++++++++++++--------- 4 files changed, 98 insertions(+), 37 deletions(-) diff --git a/go.mod b/go.mod index 500d254..c607b7e 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( ) require ( + github.com/altcha-org/altcha-lib-go v0.2.2 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect diff --git a/go.sum b/go.sum index c0d6ef5..7e98b6a 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +github.com/altcha-org/altcha-lib-go v0.2.2 h1:KY7a7jFUf6tFKZF6MzuZMhSWuGMv0MtVkK/Kj4Oas38= +github.com/altcha-org/altcha-lib-go v0.2.2/go.mod h1:I8ESLVWR9C58uvGufB/AJDPhaSU4+4Oh3DLpVtgwDAk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index 2a5c087..0b9857c 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -422,7 +422,6 @@ func (h *Handler) handleContactSubmission(w http.ResponseWriter, r *http.Request // If subscribe checkbox is checked, add to subscribers if subscribe { if err := h.db.AddSubscriber(r.Context(), email); err != nil { - // Log but don't fail the contact submission h.logger.Printf( "ℹ Subscriber %s already exists or failed to add: %v", email, @@ -463,7 +462,7 @@ func (h *Handler) handleContactSubmission(w http.ResponseWriter, r *http.Request } } - // Save contact message to database (optional - add to your DB interface) + // Save contact message to database if err := h.db.AddContactMessage(r.Context(), name, email, subject, message); err != nil { h.logger.Printf( "⚠ Failed to save contact message: %v", diff --git a/templates/contact.html b/templates/contact.html index d923b8b..a31972e 100644 --- a/templates/contact.html +++ b/templates/contact.html @@ -95,6 +95,23 @@ + +
+ +
+ +
+