47: Only lowercase host part of email
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Mon, 13 Feb 2012 22:11:49 +0000 (23:11 +0100)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Mon, 13 Feb 2012 22:20:04 +0000 (23:20 +0100)
According to most documentation it seems that the local
part of an email adress is/can be case sensitive. While
the host part is not.
So we lowercase only the host part of the given adress.

See: http://issues.mediagoblin.org/ticket/47

mediagoblin/auth/views.py

index 9af89c2ab30c59c475ec5fee769d7f2d8764c471..e18469b9220f9a7500fd680e7dfb78a3d8fff8ca 100644 (file)
@@ -60,7 +60,9 @@ def register(request):
     if request.method == 'POST' and register_form.validate():
         # TODO: Make sure the user doesn't exist already
         username = unicode(request.POST['username'].lower())
-        email = unicode(request.POST['email'].lower())
+        em_user, em_dom = unicode(request.POST['email']).split("@", 1)
+        em_dom = em_dom.lower()
+        email = em_user + "@" + em_dom
         users_with_username = request.db.User.find(
             {'username': username}).count()
         users_with_email = request.db.User.find(