Ticket #7263: secure_decorator.patch
File secure_decorator.patch, 1.0 KB (added by , 17 years ago) |
---|
-
decorators.py
83 83 if user is None: 84 84 message = ERROR_MESSAGE 85 85 if '@' in username: 86 # Mistakenly entered e-mail address instead of username? Look it up. 87 users = list(User.objects.filter(email=username)) 88 if len(users) == 1: 89 message = _("Your e-mail address is not your username. Try '%s' instead.") % users[0].username 90 else: 91 # Either we cannot find the user, or if more than 1 92 # we cannot guess which user is the correct one. 93 message = _("Usernames cannot contain the '@' character.") 86 message = _("Usernames cannot contain the '@' character.") 94 87 return _display_login_form(request, message) 95 88 96 89 # The user data is correct; log in the user in and continue.