diff --git a/cookbook/forms.py b/cookbook/forms.py index 4226af9c..a1aa4b22 100644 --- a/cookbook/forms.py +++ b/cookbook/forms.py @@ -1,5 +1,6 @@ from datetime import datetime +from allauth.account.forms import ResetPasswordForm, SignupForm from django import forms from django.conf import settings from django.core.exceptions import ValidationError @@ -9,6 +10,8 @@ from django_scopes import scopes_disabled from django_scopes.forms import SafeModelChoiceField, SafeModelMultipleChoiceField from hcaptcha.fields import hCaptchaField + + from .models import (Comment, Food, InviteLink, Keyword, Recipe, RecipeBook, RecipeBookEntry, SearchPreference, Space, Storage, Sync, User, UserPreference) @@ -313,12 +316,12 @@ class SpaceJoinForm(forms.Form): token = forms.CharField() -class AllAuthSignupForm(forms.Form): +class AllAuthSignupForm(SignupForm): captcha = hCaptchaField() terms = forms.BooleanField(label=_('Accept Terms and Privacy')) def __init__(self, **kwargs): - super(AllAuthSignupForm, self).__init__(**kwargs) + super().__init__(**kwargs) if settings.PRIVACY_URL == '' and settings.TERMS_URL == '': self.fields.pop('terms') if settings.HCAPTCHA_SECRET == '': @@ -328,6 +331,15 @@ class AllAuthSignupForm(forms.Form): pass +class CustomPasswordResetForm(ResetPasswordForm): + captcha = hCaptchaField() + + def __init__(self, **kwargs): + super(CustomPasswordResetForm, self).__init__(**kwargs) + if settings.HCAPTCHA_SECRET == '': + self.fields.pop('captcha') + + class UserCreateForm(forms.Form): name = forms.CharField(label='Username') password = forms.CharField( diff --git a/cookbook/templates/account/password_reset.html b/cookbook/templates/account/password_reset.html index 60cfd702..7337440a 100644 --- a/cookbook/templates/account/password_reset.html +++ b/cookbook/templates/account/password_reset.html @@ -34,5 +34,14 @@ +
{% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}
+{% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}
+