Ticket #8878: login_message.patch

File login_message.patch, 1.3 KB (added by jdetaeye, 16 years ago)

simple fix

  • django/contrib/admin/sites.py

     
    241241        password = request.POST.get('password', None)
    242242        user = authenticate(username=username, password=password)
    243243        if user is None:
    244             message = ERROR_MESSAGE
    245             if u'@' in username:
    246                 # Mistakenly entered e-mail address instead of username? Look it up.
    247                 try:
    248                     user = User.objects.get(email=username)
    249                 except (User.DoesNotExist, User.MultipleObjectsReturned):
    250                     message = _("Usernames cannot contain the '@' character.")
    251                 else:
    252                     if user.check_password(password):
    253                         message = _("Your e-mail address is not your username."
    254                                     " Try '%s' instead.") % user.username
    255                     else:
    256                         message = _("Usernames cannot contain the '@' character.")
    257             return self.display_login_form(request, message)
     244            return self.display_login_form(request, ERROR_MESSAGE)
    258245
    259246        # The user data is correct; log in the user in and continue.
    260247        else:
Back to Top