aboutsummaryrefslogtreecommitdiffstats
path: root/alphabetlearning/payments
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-12-09 17:16:41 +0000
committerMatthew Lemon <y@yulqen.org>2024-12-09 17:16:41 +0000
commitb481069d9444cc0756bd9f6780e7700dcf4903f5 (patch)
tree5cba9e3d501f79747c8af22bd1b0fd7d783e7ded /alphabetlearning/payments
parentd3dda8c0bd194c28cf11c189c150c00bdc3e8a83 (diff)
wip: moving home page to home app and implementing reCAPTCHA
Diffstat (limited to 'alphabetlearning/payments')
-rw-r--r--alphabetlearning/payments/forms.py5
-rw-r--r--alphabetlearning/payments/views.py2
2 files changed, 7 insertions, 0 deletions
diff --git a/alphabetlearning/payments/forms.py b/alphabetlearning/payments/forms.py
index 3aa2d95..68acfee 100644
--- a/alphabetlearning/payments/forms.py
+++ b/alphabetlearning/payments/forms.py
@@ -1,8 +1,13 @@
from django import forms
+from django_recaptcha.fields import ReCaptchaField
+from django_recaptcha.widgets import ReCaptchaV2Checkbox
+
from .models import EmailVerification
class EmailVerificationForm(forms.ModelForm):
+ captcha = ReCaptchaField(widget=ReCaptchaV2Checkbox)
+
class Meta:
model = EmailVerification
fields = ["email"]
diff --git a/alphabetlearning/payments/views.py b/alphabetlearning/payments/views.py
index 2be5344..7682c35 100644
--- a/alphabetlearning/payments/views.py
+++ b/alphabetlearning/payments/views.py
@@ -61,6 +61,8 @@ class SuccessEmailSignupView(TemplateView):
@ratelimit(key="ip", rate="2/m", block=True)
def email_signup_verification(request):
if request.method == "POST":
+ if getattr(request, "limited", False):
+ return render(request, "payments/rate_limited.html", status=429)
form = EmailVerificationForm(request.POST)
if form.is_valid():
# Create pending verification