add dumb captcha to reduce signup spam problems
This commit is contained in:
parent
35aa001289
commit
ef8b51d6d4
16
src/bornhack/forms.py
Normal file
16
src/bornhack/forms.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
from django import forms
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
|
class AllAuthSignupCaptchaForm(forms.Form):
|
||||||
|
first_bornhack_year = forms.CharField(
|
||||||
|
initial="",
|
||||||
|
help_text="Please help us prevent a few bot signups by telling us the year of the first BornHack.",
|
||||||
|
)
|
||||||
|
|
||||||
|
def clean_first_bornhack_year(self):
|
||||||
|
if self.cleaned_data["first_bornhack_year"] != "2016":
|
||||||
|
raise ValidationError("To error is human. Please try to be less human! :)")
|
||||||
|
|
||||||
|
def signup(self, request, user):
|
||||||
|
user.save()
|
|
@ -198,3 +198,6 @@ ECONOMY_TEAM_NAME = "Economy"
|
||||||
|
|
||||||
# we have some large formsets sometimes
|
# we have some large formsets sometimes
|
||||||
DATA_UPLOAD_MAX_NUMBER_FIELDS = 5000
|
DATA_UPLOAD_MAX_NUMBER_FIELDS = 5000
|
||||||
|
|
||||||
|
# use captcha form
|
||||||
|
ACCOUNT_SIGNUP_FORM_CLASS = "bornhack.forms.AllAuthSignupCaptchaForm"
|
||||||
|
|
Loading…
Reference in a new issue