add recaptcha coe
This commit is contained in:
parent
c69affc9a1
commit
dc6f5dcc5b
2 changed files with 6 additions and 0 deletions
|
@ -56,6 +56,9 @@ dotenv.load_dotenv("{0}/.env".format(PROJECT_DIR))
|
|||
|
||||
from multisite import SiteID
|
||||
|
||||
RECAPTCHA_PUBLIC_KEY = env('RECAPTCHA_PUBLIC_KEY')
|
||||
RECAPTCHA_PRIVATE_KEY = env('RECAPTCHA_PRIVATE_KEY')
|
||||
|
||||
UNGLEICH_BLOG_SITE_ID = int_env("UNGLEICH_BLOG_SITE_ID")
|
||||
SITE_ID = SiteID(default=(UNGLEICH_BLOG_SITE_ID if
|
||||
UNGLEICH_BLOG_SITE_ID > 0 else 1))
|
||||
|
|
|
@ -4,6 +4,8 @@ from django.core.mail import EmailMultiAlternatives
|
|||
from django.template.loader import render_to_string
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from captcha.fields import ReCaptchaField
|
||||
|
||||
from membership.models import CustomUser
|
||||
from .models import ContactMessage, BillingAddress, UserBillingAddress
|
||||
|
||||
|
@ -188,6 +190,7 @@ class UserBillingAddressForm(forms.ModelForm):
|
|||
|
||||
class ContactUsForm(forms.ModelForm):
|
||||
error_css_class = 'autofocus'
|
||||
captcha = ReCaptchaField()
|
||||
|
||||
class Meta:
|
||||
model = ContactMessage
|
||||
|
|
Loading…
Reference in a new issue