Ticket #5605: lowercase-email.diff
File lowercase-email.diff, 2.3 KB (added by , 16 years ago) |
---|
-
django/contrib/auth/models.py
104 104 def create_user(self, username, email, password=None): 105 105 "Creates and saves a User with the given username, e-mail and password." 106 106 now = datetime.datetime.now() 107 user = self.model(None, username, '', '', email.strip().lower(), 'placeholder', False, True, False, now, now) 107 # Make only the domain lowercase. 108 parts = email.strip().split('@', 1) 109 if len(parts) > 1: 110 parts[1] = parts[1].lower() 111 email = '@'.join(parts) 112 user = self.model(None, username, '', '', email, 'placeholder', False, True, False, now, now) 108 113 if password: 109 114 user.set_password(password) 110 115 else: -
tests/regressiontests/auth_backends/tests.py
75 75 False 76 76 >>> user.has_perms(['auth.test2', 'auth.test3']) 77 77 False 78 79 # bug #5605, preserve the case of the user name (before the @ in the email address) 80 # when creating a user. 81 82 >>> user = User.objects.create_user('test2', 'tesT@EXAMple.com', 'test') 83 >>> user.email 84 'tesT@example.com' 85 >>> user = User.objects.create_user('test3', 'tesT', 'test') 86 >>> user.email 87 'tesT' 78 88 """} -
docs/authentication.txt
168 168 The ``User`` model has a custom manager that has the following helper functions: 169 169 170 170 * ``create_user(username, email, password=None)`` -- Creates, saves and 171 returns a ``User``. The ``username``, ``email`` and ``password`` are set 172 as given, and the ``User`` gets ``is_active=True``. 171 returns a ``User``. The ``username`` and ``password`` are set as 172 given, the domain portion of ``email`` gets lowercased, and the 173 ``User`` gets ``is_active=True``. 173 174 174 175 If no password is provided, ``set_unusable_password()`` will be called. 175 176