Commits

Anonymous committed 2172263

[svn r91] patch applied from issue #40. Seem fair.

Comments (0)

Files changed (1)

django_authopenid/forms.py

             except User.DoesNotExist:
                 raise forms.ValidationError(_("This username does not exist \
                     in our database. Please choose another."))
+            except User.MultipleObjectsReturned:
+                raise forms.ValidationError(u'There is already more than one \
+                    account registered with that username. Please try \
+                    another.')
             return self.cleaned_data['username']
 
     def clean_password(self):
                         )
             except User.DoesNotExist:
                 return self.cleaned_data['username']
+            except User.MultipleObjectsReturned:
+                raise forms.ValidationError(u'There is already more than one \
+                    account registered with that username. Please try \
+                    another.')
             raise forms.ValidationError(_("This username is already \
                 taken. Please choose another."))
             
                 user = User.objects.get(email = self.cleaned_data['email'])
             except User.DoesNotExist:
                 return self.cleaned_data['email']
+            except User.MultipleObjectsReturned:
+                raise forms.ValidationError(u'There is already more than one \
+                    account registered with that e-mail address. Please try \
+                    another.')
             raise forms.ValidationError(_("This email is already \
                 registered in our database. Please choose another."))
  
             except User.DoesNotExist:
                 raise forms.ValidationError(_("This username don't exist. \
                         Please choose another."))
+            except User.MultipleObjectsReturned:
+                raise forms.ValidationError(u'Somehow, that username is in \
+                    use for multiple accounts. Please contact us to get this \
+                    problem resolved.')
             return self.cleaned_data['username']
             
     def clean_password(self):
 
             except User.DoesNotExist:
                 return self.cleaned_data['username']
+            except User.MultipleObjectsReturned:
+                raise forms.ValidationError(u'Somehow, that username is in \
+                    use for multiple accounts. Please contact us to get this \
+                    problem resolved.')
             raise forms.ValidationError(u'This username is already taken. \
                     Please choose another.')
 
                 user = User.objects.get(email = self.cleaned_data['email'])
             except User.DoesNotExist:
                 return self.cleaned_data['email']
+            except User.MultipleObjectsReturned:
+                raise forms.ValidationError(u'There is already more than one \
+                    account registered with that e-mail address. Please try \
+                    another.')
             raise forms.ValidationError(u'This email is already registered \
                     in our database. Please choose another.')
         return self.cleaned_data['email']