SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 1f0d6659 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Add captcha for registration (django-simple-captcha)

parent bc242923
No related branches found
No related tags found
No related merge requests found
...@@ -55,6 +55,7 @@ INSTALLED_APPS = ( ...@@ -55,6 +55,7 @@ INSTALLED_APPS = (
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'django_countries', 'django_countries',
'django_mathjax', 'django_mathjax',
'captcha',
'commentaries', 'commentaries',
'comments', 'comments',
# 'contributors', # 'contributors',
...@@ -65,6 +66,10 @@ INSTALLED_APPS = ( ...@@ -65,6 +66,10 @@ INSTALLED_APPS = (
'submissions', 'submissions',
) )
CAPTCHA_CHALLENGE_FUNCT = 'captcha.helpers.math_challenge'
CAPTCHA_LETTER_ROTATION = (-15, 15)
CAPTCHA_NOISE_FUNCTIONS = ('captcha.helpers.noise_dots',)
MATHJAX_ENABLED = True MATHJAX_ENABLED = True
MATHJAX_CONFIG_DATA = { MATHJAX_CONFIG_DATA = {
"tex2jax": { "tex2jax": {
......
...@@ -27,4 +27,6 @@ urlpatterns = [ ...@@ -27,4 +27,6 @@ urlpatterns = [
url(r'^ratings/', include('ratings.urls', namespace="ratings")), url(r'^ratings/', include('ratings.urls', namespace="ratings")),
# url(r'^reports/', include('reports.urls', namespace="reports")), # url(r'^reports/', include('reports.urls', namespace="reports")),
url(r'^submissions/', include('submissions.urls', namespace="submissions")), url(r'^submissions/', include('submissions.urls', namespace="submissions")),
url(r'^captcha/', include('captcha.urls')),
] ]
...@@ -3,6 +3,7 @@ from django import forms ...@@ -3,6 +3,7 @@ from django import forms
from django_countries import countries from django_countries import countries
from django_countries.widgets import CountrySelectWidget from django_countries.widgets import CountrySelectWidget
from django_countries.fields import LazyTypedChoiceField from django_countries.fields import LazyTypedChoiceField
from captcha.fields import CaptchaField
from .models import * from .models import *
...@@ -29,6 +30,7 @@ class RegistrationForm(forms.Form): ...@@ -29,6 +30,7 @@ class RegistrationForm(forms.Form):
username = forms.CharField(label='username', max_length=100) username = forms.CharField(label='username', max_length=100)
password = forms.CharField(label='password', widget=forms.PasswordInput()) password = forms.CharField(label='password', widget=forms.PasswordInput())
password_verif = forms.CharField(label='verify pwd', widget=forms.PasswordInput()) password_verif = forms.CharField(label='verify pwd', widget=forms.PasswordInput())
captcha = CaptchaField()
#class RegistrationFormUser(forms.ModelForm): #class RegistrationFormUser(forms.ModelForm):
# class Meta: # class Meta:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment