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