Ticket #5605: 5605_EmailCase.diff

File 5605_EmailCase.diff, 986 bytes (added by drowe, 8 years ago)

Patch for lowercasing domain, but leaving user unchanged.

  • django/contrib/auth/models.py

     
    108108    def create_user(self, username, email, password=None):
    109109        "Creates and saves a User with the given username, e-mail and password."
    110110        now = datetime.datetime.now()
    111         user = self.model(None, username, '', '', email.strip().lower(), 'placeholder', False, True, False, now, now)
     111        email_addr = email.strip()
     112        email_user_idx = email.find('@')
     113        email_user = email_addr[0:email_user_idx]
     114        email_domain = email_addr[email_user_idx:len(email_addr)].lower()
     115        email_addr_final = u'%s%s' % (email_user, email_domain)
     116        user = self.model(None, username, '', '', email_addr_final, 'placeholder', False, True, False, now, now)
    112117        if password:
    113118            user.set_password(password)
    114119        else:
Back to Top