Tino de Bruijn  committed 7007d0e

Fix issue #3. All email will be saved lowercase, and lookups are iexact.

  • Participants
  • Parent commits 811b0f7
  • Branches default

Comments (0)

Files changed (3)

File email_login/

     def authenticate(self, email=None, password=None):
-            user = User.objects.get(email=email)
+            user = User.objects.get(email__iexact=email.lower())
             if user.check_password(password):
                 return user
         except User.DoesNotExist:

File email_login/

 from django.utils.translation import ugettext_lazy as _
 def email_to_username(email):
-    return base64.urlsafe_b64encode(hashlib.sha256(email).digest())[:30]
+    return base64.urlsafe_b64encode(hashlib.sha256(email.lower()).digest())[:30]
 class EmailAuthenticationForm(forms.Form):
         super(EmailAuthenticationForm, self).__init__(*args, **kwargs)
     def clean(self):
-        email = self.cleaned_data.get('email')
+        email = self.cleaned_data.get('email').lower()
         password = self.cleaned_data.get('password')
         if email and password:
             self.user_cache = authenticate(email=email, password=password)
             if self.user_cache is None:
-                raise forms.ValidationError(_("Please enter a correct email address and password. Note that both fields are case-sensitive."))
+                raise forms.ValidationError(_("Please enter a correct email address and password."))
             elif not self.user_cache.is_active:
                 raise forms.ValidationError(_("This account is inactive."))
     def clean_email(self):
         """ Validates that the email address is not already in use. """
-        email = self.cleaned_data["email"]
+        email = self.cleaned_data["email"].lower()
-            User.objects.get(email=email)
+            User.objects.get(email__iexact=email)
         except User.DoesNotExist:
             return email
         raise forms.ValidationError(_("A user with that email address already exists."))
 class EmailUserChangeForm(forms.ModelForm):
     email = forms.EmailField(label=_("Email address"))
     class Meta:
         model = User
         exclude = ('username',)

File email_login/locale/nl/LC_MESSAGES/django.po

 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-12-28 17:41+0100\n"
+"POT-Creation-Date: 2012-04-02 16:35+0200\n"
 "PO-Revision-Date: 2010-12-28 13:53+0100\n"
 "Last-Translator: Tino de Bruijn <>\n"
 "Language-Team: LANGUAGE <>\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
-#: templates/email_login/login.html:33
+#: templates/email_login/login.html:33
 msgid "Email address"
 msgstr "Emailadres"
-#: templates/email_login/login.html:37
+#: templates/email_login/login.html:37
 msgid "Password"
-msgstr ""
+msgstr "Wachtwoord"
-msgid ""
-"Please enter a correct email address and password. Note that both fields are "
-msgstr ""
-"Vul een juist emailadres en wachtwoord in. Beide velden zijn hoofdletter-"
+#, fuzzy
+msgid "Please enter a correct email address and password."
+msgstr "Vul een juist emailadres en wachtwoord in."
 msgid "This account is inactive."
 msgstr "Dit account is in-actief "
 msgid ""
 "Your Web browser doesn't appear to have cookies enabled. Cookies are "
 "required for logging in."
 msgstr ""
 msgid "Password confirmation"
 msgstr ""
 msgid "Enter the same password as above, for verification."
 msgstr ""
 msgid "A user with that email address already exists."
 msgstr "Een gebruiker met dat emailadres bestaat al."
 msgid "The two password fields didn't match."
 msgstr ""