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) |