mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-21 15:32:14 +00:00
Merged in recaptcha (pull request #28)
Add recaptcha to all public facing pages.
This commit is contained in:
@@ -3,7 +3,9 @@ from django import forms
|
||||
from django.utils import formats
|
||||
from django.conf import settings
|
||||
from django.core import serializers
|
||||
from django.contrib.auth.forms import AuthenticationForm, PasswordResetForm
|
||||
from registration.forms import RegistrationFormUniqueEmail
|
||||
from captcha.fields import ReCaptchaField
|
||||
import simplejson
|
||||
|
||||
from RIGS import models
|
||||
@@ -14,6 +16,7 @@ class ProfileRegistrationFormUniqueEmail(RegistrationFormUniqueEmail):
|
||||
last_name = forms.CharField(required=False, max_length=50)
|
||||
initials = forms.CharField(required=True, max_length=5)
|
||||
phone = forms.CharField(required=False, max_length=13)
|
||||
captcha = ReCaptchaField()
|
||||
|
||||
def clean_initials(self):
|
||||
"""
|
||||
@@ -23,6 +26,13 @@ class ProfileRegistrationFormUniqueEmail(RegistrationFormUniqueEmail):
|
||||
raise forms.ValidationError("These initials are already in use. Please supply different initials.")
|
||||
return self.cleaned_data['initials']
|
||||
|
||||
# Login form
|
||||
class LoginForm(AuthenticationForm):
|
||||
captcha = ReCaptchaField(label='Captcha')
|
||||
|
||||
class PasswordReset(PasswordResetForm):
|
||||
captcha = ReCaptchaField(label='Captcha')
|
||||
|
||||
# Events Shit
|
||||
class EventForm(forms.ModelForm):
|
||||
datetime_input_formats = formats.get_format_lazy("DATETIME_INPUT_FORMATS") + settings.DATETIME_INPUT_FORMATS
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from django.conf.urls import patterns, include, url
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from RIGS import views, rigboard, finance, ical
|
||||
from RIGS import views, rigboard, finance, ical, forms
|
||||
from django.views.generic import RedirectView
|
||||
|
||||
from PyRIGS.decorators import permission_required_with_403
|
||||
@@ -14,6 +14,7 @@ urlpatterns = patterns('',
|
||||
url(r'^closemodal/$', views.CloseModal.as_view(), name='closemodal'),
|
||||
|
||||
url('^user/login/$', 'RIGS.views.login', name='login'),
|
||||
url(r'^user/password_reset/$', 'django.contrib.auth.views.password_reset', {'password_reset_form':forms.PasswordReset}),
|
||||
|
||||
# People
|
||||
url(r'^people/$', permission_required_with_403('RIGS.view_person')(views.PersonList.as_view()),
|
||||
|
||||
@@ -30,7 +30,7 @@ def login(request, **kwargs):
|
||||
else:
|
||||
from django.contrib.auth.views import login
|
||||
|
||||
return login(request)
|
||||
return login(request, authentication_form=forms.LoginForm)
|
||||
|
||||
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user