Commits

glo committed bb68862

Check to make sure user entered an email and not a duplicate one.

  • Participants
  • Parent commits 8376235

Comments (0)

Files changed (1)

File pinax/apps/account/forms.py

     
     def clean_email(self):
         value = self.cleaned_data["email"]
+
+        if value == '':
+            if self.fields['email'].required is True:
+                raise forms.ValidationError(_("You need to enter a valid email address"))
+            else:
+                return value
+
         if UNIQUE_EMAIL or EMAIL_AUTHENTICATION:
             try:
                 User.objects.get(email__iexact=value)
+            except User.MultipleObjectsReturned:
+                raise forms.ValidationError(_("A user is registered with this email address."))
             except User.DoesNotExist:
                 return value
             raise forms.ValidationError(_("A user is registered with this email address."))