diff options
author | Matthew Lemon <y@yulqen.org> | 2024-12-09 17:38:19 +0000 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-12-09 17:38:19 +0000 |
commit | b896eb2fcfe34667c5ff7d5e0783fe6b2080ae50 (patch) | |
tree | dc68fd932191ef01429d8ddbeef11a1bbae9f949 | |
parent | b481069d9444cc0756bd9f6780e7700dcf4903f5 (diff) |
Adds v3 reCAPCHA to the field
-rw-r--r-- | alphabetlearning/pages/views.py | 8 | ||||
-rw-r--r-- | alphabetlearning/payments/forms.py | 4 | ||||
-rw-r--r-- | alphabetlearning/templates/pages/home.html | 7 |
3 files changed, 17 insertions, 2 deletions
diff --git a/alphabetlearning/pages/views.py b/alphabetlearning/pages/views.py index 81d4392..c4a4017 100644 --- a/alphabetlearning/pages/views.py +++ b/alphabetlearning/pages/views.py @@ -1,5 +1,13 @@ from django.views.generic import TemplateView +from alphabetlearning.payments.views import EmailVerificationForm + class HomePageView(TemplateView): template_name = "pages/home.html" + + def get_context_data(self, **kwargs): + kwargs.setdefault("view", self) + form = EmailVerificationForm() + kwargs.update({"form": form}) + return kwargs diff --git a/alphabetlearning/payments/forms.py b/alphabetlearning/payments/forms.py index 68acfee..bfa23ac 100644 --- a/alphabetlearning/payments/forms.py +++ b/alphabetlearning/payments/forms.py @@ -1,12 +1,12 @@ from django import forms from django_recaptcha.fields import ReCaptchaField -from django_recaptcha.widgets import ReCaptchaV2Checkbox +from django_recaptcha.widgets import ReCaptchaV3 from .models import EmailVerification class EmailVerificationForm(forms.ModelForm): - captcha = ReCaptchaField(widget=ReCaptchaV2Checkbox) + captcha = ReCaptchaField(widget=ReCaptchaV3()) class Meta: model = EmailVerification diff --git a/alphabetlearning/templates/pages/home.html b/alphabetlearning/templates/pages/home.html index 0d00042..64c9972 100644 --- a/alphabetlearning/templates/pages/home.html +++ b/alphabetlearning/templates/pages/home.html @@ -68,6 +68,13 @@ <div> {{ form.captcha }} </div> + <div> + {% if form.captcha.errors %} + <div class="error"> + {{ form.captcha.errors }} + </div> + {% endif %} + </div> <button type="submit" style=" |