Commits

Cole Krumbholz  committed 20b2635

made email registration always lowercase

  • Participants
  • Parent commits adfa86c

Comments (0)

Files changed (2)

File registration/__init__.py

     def authenticate(self, username=None, password=None):
         if email_re.search(username):
             try:
-                user = User.objects.get(email=username)
+                user = User.objects.get(email=username.strip().lower())
             except User.DoesNotExist:
                 return None
         else:

File registration/forms.py

             #
             # In my limited testing I have not found a problem with usernames > 30 characters long
             # so I simply use the email for the username:
-            
+            self.cleaned_data['email'] = self.cleaned_data['email'].strip().lower()
             self.cleaned_data['username'] = self.cleaned_data['email']
             
         super(RegistrationFormNoUserName, self).clean()
         super(RegistrationFormNoUserName, self).__init__(*args, **kwargs)
         self.fields.keyOrder = ['email', 'first_name', 'last_name', 'password1', 'password2']
 
+# 
+# class RegistrationFormNUNDefaultEmail(RegistrationFormNoUserName):
+# 
+#     def __init__(self, *args, **kwargs):
+#         # reorder the fields
+#         # see discussion at http://stackoverflow.com/questions/913589/django-forms-inheritance-and-order-of-form-fields
+#         
+#         super(RegistrationFormNUNDefaultEmail, self).__init__(*args, **kwargs)
+#         self.fields.keyOrder = ['email', 'first_name', 'last_name', 'password1', 'password2']
+
 
 class RegistrationFormNoFreeEmail(RegistrationForm):
     """