From 54a155d7c47486e6260608658f12acde4847771a Mon Sep 17 00:00:00 2001 From: nathaniel smith Date: Mon, 19 Dec 2016 23:09:09 -0800 Subject: [PATCH] use bootleg throttle thing on user signups --- ttadmin/users/forms.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ttadmin/users/forms.py b/ttadmin/users/forms.py index d7123bb..5fd11af 100644 --- a/ttadmin/users/forms.py +++ b/ttadmin/users/forms.py @@ -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