aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-02-27 08:18:57 +0000
committerChristopher Baines <mail@cbaines.net>2021-02-27 08:43:13 +0000
commit86b335352aa913fe51d30e84531485cdc3c89681 (patch)
tree35b67cd11397d60f67bd5186376c547f0f8fd1fc
parent5e95462b2840d6e495c3bd1c141224912667843b (diff)
downloadpatchwork-86b335352aa913fe51d30e84531485cdc3c89681.tar
patchwork-86b335352aa913fe51d30e84531485cdc3c89681.tar.gz
forms: Use a captcha on the registration form.add-captcha
This should help avoid spam registration requests.
-rw-r--r--patchwork/forms.py3
-rw-r--r--patchwork/settings/base.py1
2 files changed, 4 insertions, 0 deletions
diff --git a/patchwork/forms.py b/patchwork/forms.py
index e06cfc1..f02bd29 100644
--- a/patchwork/forms.py
+++ b/patchwork/forms.py
@@ -8,6 +8,8 @@ from django import forms
from django.db.models import Q
from django.db.utils import ProgrammingError
+from simplemathcaptcha.fields import MathCaptchaField
+
from patchwork.models import Bundle
from patchwork.models import Patch
from patchwork.models import State
@@ -27,6 +29,7 @@ class RegistrationForm(forms.Form):
label=u'Username')
password = forms.CharField(widget=forms.PasswordInput(),
label='Password')
+ captcha = MathCaptchaField()
def clean_username(self):
value = self.cleaned_data['username']
diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py
index c1bb9b2..e18ee60 100644
--- a/patchwork/settings/base.py
+++ b/patchwork/settings/base.py
@@ -21,6 +21,7 @@ INSTALLED_APPS = [
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.staticfiles',
+ 'simplemathcaptcha',
'patchwork',
]