diff --git a/src/bornhack/forms.py b/src/bornhack/forms.py new file mode 100644 index 00000000..9aa8b81b --- /dev/null +++ b/src/bornhack/forms.py @@ -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() diff --git a/src/bornhack/settings.py b/src/bornhack/settings.py index 4e4c9ec3..da1e8781 100644 --- a/src/bornhack/settings.py +++ b/src/bornhack/settings.py @@ -198,3 +198,6 @@ ECONOMY_TEAM_NAME = "Economy" # we have some large formsets sometimes DATA_UPLOAD_MAX_NUMBER_FIELDS = 5000 + +# use captcha form +ACCOUNT_SIGNUP_FORM_CLASS = "bornhack.forms.AllAuthSignupCaptchaForm"