Django

Code

Ticket #6943: 6943-admin-multiple-emails.diff

File 6943-admin-multiple-emails.diff, 0.7 kB (added by Mnewman, 9 months ago)

simple two line patch to catch the exception and return a generic message

  • django/contrib/admin/sites.py

    old new  
    228228                    user = User.objects.get(email=username) 
    229229                except User.DoesNotExist: 
    230230                    message = _("Usernames cannot contain the '@' character.") 
     231                except User.MultipleObjectsReturned: 
     232                    message = _("Your e-mail address is not your username") 
    231233                else: 
    232234                    message = _("Your e-mail address is not your username. Try '%s' instead.") % user.username 
    233235            return _display_login_form(request, message)