~proycon/MailyGo

bf2c1447985bdce189a655c1b60db46f3ef8a4ab — Maarten van Gompel 1 year, 1 month ago 439fc8e master
feedback on send failure
1 files changed, 8 insertions(+), 6 deletions(-)

M forms.go
M forms.go => forms.go +8 -6
@@ 24,12 24,14 @@ func FormHandler(w http.ResponseWriter, r *http.Request) {
	}
	_ = r.ParseForm()
	sanitizedForm := sanitizeForm(&r.PostForm)
	go func() {
		if !isBot(sanitizedForm) {
			sendForm(sanitizedForm)
		}
	}()
	sendResponse(sanitizedForm, w)
	if !isBot(sanitizedForm) {
		sendForm(sanitizedForm)
		sendResponse(sanitizedForm, w)
	} else {
		w.WriteHeader(http.StatusForbidden)
		_, _ = w.Write([]byte("Your message could not be sent, did you answer the control question correctly? Press the back button and try again. / Uw bericht kon niet verstuurd worden. Heeft u de controlevraag juist beantwoord? Klik terug en probeer opnieuw."))
		return
	}
	return
}