]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/forms.py
Fixes a possible future bug in edit user.
[osqa.git] / forum / forms.py
index 0a5afe39f3ce590124e158af0004ae7e10ea113d..0b865374625542efaa720a6766144cf7108a500b 100644 (file)
@@ -226,7 +226,7 @@ class EditAnswerForm(forms.Form):
             self.fields['wiki'] = WikiField(disabled=(answer.nis.wiki and not user.can_cancel_wiki(answer)), initial=answer.nis.wiki)
 
 class EditUserForm(forms.Form):
-    email = forms.EmailField(label=u'Email', help_text=_('this email does not have to be linked to gravatar'), required=True, max_length=255, widget=forms.TextInput(attrs={'size' : 35}))
+    email = forms.EmailField(label=u'Email', help_text=_('this email does not have to be linked to gravatar'), required=True, max_length=75, widget=forms.TextInput(attrs={'size' : 35}))
     realname = forms.CharField(label=_('Real name'), required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35}))
     website = forms.URLField(label=_('Website'), required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35}))
     city = forms.CharField(label=_('Location'), required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35}))
@@ -256,11 +256,12 @@ class EditUserForm(forms.Form):
             if settings.EMAIL_UNIQUE == True:
                 if 'email' in self.cleaned_data:
                     try:
-                        user = User.objects.get(email = self.cleaned_data['email'])
+                        User.objects.get(email = self.cleaned_data['email'])
                     except User.DoesNotExist:
                         return self.cleaned_data['email']
                     except User.MultipleObjectsReturned:
-                        raise forms.ValidationError(_('this email has already been registered, please use another one'))
+                        logging.error("Found multiple users sharing the same email: %s" % self.cleaned_data['email'])
+                        
                     raise forms.ValidationError(_('this email has already been registered, please use another one'))
         return self.cleaned_data['email']