use bootleg throttle thing on user signups

pull/1/head
nathaniel smith 2016-12-19 23:09:09 -08:00
parent 04ca1fd058
commit 54a155d7c4
1 changed files with 5 additions and 1 deletions

View File

@ -6,7 +6,10 @@ from django.forms import Form, CharField, EmailField, Textarea, ChoiceField, Boo
import sshpubkeys as ssh
from .models import Townie, SSH_TYPE_CHOICES
from common.forms import CaptchaField
from common.forms import CaptchaField, throttler
submission_throttle = {}
throttle_submission = throttler(submission_throttle)
USERNAME_RE = re.compile(r'[a-z][a-z0-9_]+')
@ -80,4 +83,5 @@ class TownieForm(Form):
result = super().clean()
if self.errors:
raise ValidationError('oops, looks like there were some problems below.')
throttle_submission(self.cleaned_data['email'])
return result