Ticket #13928: 13928-1.diff

File 13928-1.diff, 1.2 KB (added by mattmcc, 5 years ago)
  • django/contrib/admin/sites.py

     
    322322        user = authenticate(username=username, password=password)
    323323        if user is None:
    324324            message = ERROR_MESSAGE
    325             if username is not None and u'@' in username:
    326                 # Mistakenly entered e-mail address instead of username? Look it up.
    327                 try:
    328                     user = User.objects.get(email=username)
    329                 except (User.DoesNotExist, User.MultipleObjectsReturned):
    330                     message = _("Usernames cannot contain the '@' character.")
    331                 else:
    332                     if user.check_password(password):
    333                         message = _("Your e-mail address is not your username."
    334                                     " Try '%s' instead.") % user.username
    335                     else:
    336                         message = _("Usernames cannot contain the '@' character.")
    337325            return self.display_login_form(request, message)
    338326
    339327        # The user data is correct; log in the user in and continue.
Back to Top