Index: django/contrib/auth/models.py
===================================================================
--- django/contrib/auth/models.py	(revision 8145)
+++ django/contrib/auth/models.py	(working copy)
@@ -104,7 +104,12 @@
     def create_user(self, username, email, password=None):
         "Creates and saves a User with the given username, e-mail and password."
         now = datetime.datetime.now()
-        user = self.model(None, username, '', '', email.strip().lower(), 'placeholder', False, True, False, now, now)
+        # Make only the domain lowercase.
+        parts = email.strip().split('@', 1)
+        if len(parts) > 1:
+            parts[1] = parts[1].lower()
+        email = '@'.join(parts)
+        user = self.model(None, username, '', '', email, 'placeholder', False, True, False, now, now)
         if password:
             user.set_password(password)
         else:
Index: tests/regressiontests/auth_backends/tests.py
===================================================================
--- tests/regressiontests/auth_backends/tests.py	(revision 8145)
+++ tests/regressiontests/auth_backends/tests.py	(working copy)
@@ -75,4 +75,14 @@
 False
 >>> user.has_perms(['auth.test2', 'auth.test3'])
 False
+
+# bug #5605, preserve the case of the user name (before the @ in the email address)
+# when creating a user.
+
+>>> user = User.objects.create_user('test2', 'tesT@EXAMple.com', 'test')
+>>> user.email
+'tesT@example.com'
+>>> user = User.objects.create_user('test3', 'tesT', 'test')
+>>> user.email
+'tesT'
 """}
Index: docs/authentication.txt
===================================================================
--- docs/authentication.txt	(revision 8145)
+++ docs/authentication.txt	(working copy)
@@ -168,8 +168,9 @@
 The ``User`` model has a custom manager that has the following helper functions:
 
     * ``create_user(username, email, password=None)`` -- Creates, saves and
-      returns a ``User``. The ``username``, ``email`` and ``password`` are set
-      as given, and the ``User`` gets ``is_active=True``.
+      returns a ``User``. The ``username`` and ``password`` are set as
+      given, the domain portion of ``email`` gets lowercased, and the
+      ``User`` gets ``is_active=True``.
 
       If no password is provided, ``set_unusable_password()`` will be called.
 
