Private
Public Access
1
0

form fixed

This commit is contained in:
2024-05-22 20:57:31 +02:00
parent ce978bfe8e
commit fc35034c7c
3 changed files with 10 additions and 2 deletions

View File

@@ -242,7 +242,11 @@ class EmailForm(forms.Form):
email = forms.EmailField()
subject = forms.CharField(max_length=255)
message = forms.CharField(widget=forms.Textarea())
captcha = ReCaptchaField(widget=ReCaptchaV3)
captcha = ReCaptchaField(widget=ReCaptchaV3(
attrs={
'required_score': 0.85,
}
))
disqualificationreasons = (

View File

@@ -1,11 +1,11 @@
{% extends "newbase.html" %}
{% block title %}Contact Us{% endblock title %}
{% block main %}
<h1>Contact us through email</h1>
<ul class="main-content">
<li class="grid_2">
<h1>Contact us through email</h1>
{% if form.errors %}
<p style="color: red;">
Please correct the error{{ form.errors|pluralize }} below.

View File

@@ -1300,6 +1300,10 @@ def sendmail(request):
messages.error(
request, "Something went wrong trying to send the form")
return HttpResponseRedirect('/rowers/email/thankyou/')
else:
if "captcha" in form.errors:
messages.error(request,"Bots are not welcome")
return HttpResponseRedirect(reverse("sendmail"))
return render(request,'email.html',