diff --git a/SciPost_v1/settings.py b/SciPost_v1/settings.py index 789a491eca37a91c0ed9d3fc3e44bee7e72f483c..7d636f1353b98e25cda11493c1ca90f86d821242 100644 --- a/SciPost_v1/settings.py +++ b/SciPost_v1/settings.py @@ -55,6 +55,7 @@ INSTALLED_APPS = ( 'django.contrib.staticfiles', 'django_countries', 'django_mathjax', + 'captcha', 'commentaries', 'comments', # 'contributors', @@ -65,6 +66,10 @@ INSTALLED_APPS = ( 'submissions', ) +CAPTCHA_CHALLENGE_FUNCT = 'captcha.helpers.math_challenge' +CAPTCHA_LETTER_ROTATION = (-15, 15) +CAPTCHA_NOISE_FUNCTIONS = ('captcha.helpers.noise_dots',) + MATHJAX_ENABLED = True MATHJAX_CONFIG_DATA = { "tex2jax": { diff --git a/SciPost_v1/urls.py b/SciPost_v1/urls.py index 2f59a7489bb7059bc242a54f46134ecdf3e1af15..53a835b00fa60c3211a359052a115b441c828d89 100644 --- a/SciPost_v1/urls.py +++ b/SciPost_v1/urls.py @@ -27,4 +27,6 @@ urlpatterns = [ url(r'^ratings/', include('ratings.urls', namespace="ratings")), # url(r'^reports/', include('reports.urls', namespace="reports")), url(r'^submissions/', include('submissions.urls', namespace="submissions")), + url(r'^captcha/', include('captcha.urls')), ] + diff --git a/scipost/forms.py b/scipost/forms.py index 9a44888e912b255a988a0cefa7b5a150ca637eb5..45e3264568a8bfdb84715ee097bcd5681f77006f 100644 --- a/scipost/forms.py +++ b/scipost/forms.py @@ -3,6 +3,7 @@ from django import forms from django_countries import countries from django_countries.widgets import CountrySelectWidget from django_countries.fields import LazyTypedChoiceField +from captcha.fields import CaptchaField from .models import * @@ -29,6 +30,7 @@ class RegistrationForm(forms.Form): username = forms.CharField(label='username', max_length=100) password = forms.CharField(label='password', widget=forms.PasswordInput()) password_verif = forms.CharField(label='verify pwd', widget=forms.PasswordInput()) + captcha = CaptchaField() #class RegistrationFormUser(forms.ModelForm): # class Meta: