From bb3e7a04498b7582df94fc588df925a253fae2fc Mon Sep 17 00:00:00 2001 From: Adarnof Date: Mon, 10 Apr 2017 14:27:17 -0400 Subject: [PATCH] Tolerate validating submitted email if 2+ users Addresses #783 --- authentication/forms.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/authentication/forms.py b/authentication/forms.py index 7374ac03..5603dc4d 100644 --- a/authentication/forms.py +++ b/authentication/forms.py @@ -30,12 +30,8 @@ class RegistrationForm(forms.Form): if ' ' in self.cleaned_data['username']: raise forms.ValidationError('Username cannot contain a space') - # We attempt to get the user object if we succeed we know email as been used - try: - User.objects.get(email=self.cleaned_data['email']) + if User.objects.filter(email=self.cleaned_data['email']).count() >= 1: raise forms.ValidationError('Email as already been used') - except User.DoesNotExist: - pass if not re.match("^\w+$", self.cleaned_data['username']): raise forms.ValidationError('Username contains illegal characters')