diff -rupN admin/media/css/login.css /home/kyle/django/contrib/admin/media/css/login.css --- admin/media/css/login.css 2009-01-29 22:05:47.000000000 -0700 +++ /home/kyle/django/contrib/admin/media/css/login.css 2009-01-08 22:05:47.000000000 -0700 @@ -8,6 +8,6 @@ body.login { background:#eee; } .login form { margin-top:1em; } .login .form-row { padding:4px 0; float:left; width:100%; } .login .form-row label { float:left; width:9em; padding-right:0.5em; line-height:2em; text-align:right; font-size:1em; color:#333; } -.login .form-row #id_username, .login .form-row #id_password { width:14em; } +.login .form-row #id_email, .login .form-row #id_password { width:14em; } .login span.help { font-size:10px; display:block; } -.login .submit-row { clear:both; padding:1em 0 0 9.4em; } \ No newline at end of file +.login .submit-row { clear:both; padding:1em 0 0 9.4em; } diff -rupN admin/sites.py /home/kyle/django/contrib/admin/sites.py --- admin/sites.py 2009-01-29 22:05:47.000000000 -0700 +++ /home/kyle/django/contrib/admin/sites.py 2009-01-08 22:05:47.000000000 -0700 @@ -13,7 +13,7 @@ from django.views.decorators.cache impor from django.conf import settings from django.utils.hashcompat import md5_constructor -ERROR_MESSAGE = ugettext_lazy("Please enter a correct username and password. Note that both fields are case-sensitive.") +ERROR_MESSAGE = ugettext_lazy("Please enter a correct email and password. Note that both fields are case-sensitive.") LOGIN_FORM_KEY = 'this_is_the_login_form' class AlreadyRegistered(Exception): @@ -237,23 +237,11 @@ class AdminSite(object): request.session.delete_test_cookie() # Check the password. - username = request.POST.get('username', None) + email = request.POST.get('email', None) password = request.POST.get('password', None) - user = authenticate(username=username, password=password) + user = authenticate(email=email, password=password) if user is None: message = ERROR_MESSAGE - if u'@' in username: - # Mistakenly entered e-mail address instead of username? Look it up. - try: - user = User.objects.get(email=username) - except (User.DoesNotExist, User.MultipleObjectsReturned): - message = _("Usernames cannot contain the '@' character.") - else: - if user.check_password(password): - message = _("Your e-mail address is not your username." - " Try '%s' instead.") % user.username - else: - message = _("Usernames cannot contain the '@' character.") return self.display_login_form(request, message) # The user data is correct; log in the user in and continue. diff -rupN admin/templates/admin/auth/user/add_form.html /home/kyle/django/contrib/admin/templates/admin/auth/user/add_form.html --- admin/templates/admin/auth/user/add_form.html 2009-01-29 22:05:47.000000000 -0700 +++ /home/kyle/django/contrib/admin/templates/admin/auth/user/add_form.html 2009-01-08 22:05:47.000000000 -0700 @@ -3,15 +3,15 @@ {% block after_field_sets %} -

{% trans "First, enter a username and password. Then, you'll be able to edit more user options." %}

+

{% trans "First, enter a email and password. Then, you'll be able to edit more user options." %}

- {{ form.username.errors }} + {{ form.email.errors }} {# TODO: get required class on label_tag #} - {{ form.username }} -

{{ form.username.help_text }}

+ {{ form.email }} +

{{ form.email.help_text }}

@@ -27,7 +27,7 @@

{% trans 'Enter the same password as above, for verification.' %}

- +
{% endblock %} diff -rupN admin/templates/admin/auth/user/change_password.html /home/kyle/django/contrib/admin/templates/admin/auth/user/change_password.html --- admin/templates/admin/auth/user/change_password.html 2009-01-29 22:05:47.000000000 -0700 +++ /home/kyle/django/contrib/admin/templates/admin/auth/user/change_password.html 2009-01-08 22:05:47.000000000 -0700 @@ -23,7 +23,7 @@

{% endif %} -

{% blocktrans with original.username|escape as username %}Enter a new password for the user {{ username }}.{% endblocktrans %}

+

{% blocktrans with original.email|escape as email %}Enter a new password for the user {{ email }}.{% endblocktrans %}

diff -rupN admin/templates/admin/base.html /home/kyle/django/contrib/admin/templates/admin/base.html --- admin/templates/admin/base.html 2009-01-29 22:05:47.000000000 -0700 +++ /home/kyle/django/contrib/admin/templates/admin/base.html 2009-01-08 22:05:47.000000000 -0700 @@ -22,7 +22,7 @@ {% block branding %}{% endblock %} {% if user.is_authenticated and user.is_staff %} -
{% trans 'Welcome,' %} {% if user.first_name %}{{ user.first_name|escape }}{% else %}{{ user.username }}{% endif %}. {% block userlinks %}{% url django-admindocs-docroot as docsroot %}{% if docsroot %}{% trans 'Documentation' %} / {% endif %}{% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %}
+
{% trans 'Welcome,' %} {% if user.first_name %}{{ user.first_name|escape }}{% else %}{{ user.email }}{% endif %}. {% block userlinks %}{% url django-admindocs-docroot as docsroot %}{% if docsroot %}{% trans 'Documentation' %} / {% endif %}{% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %}
{% endif %} {% block nav-global %}{% endblock %} diff -rupN admin/templates/admin/login.html /home/kyle/django/contrib/admin/templates/admin/login.html --- admin/templates/admin/login.html 2009-01-29 22:05:47.000000000 -0700 +++ /home/kyle/django/contrib/admin/templates/admin/login.html 2009-01-08 22:05:47.000000000 -0700 @@ -16,7 +16,7 @@
- +
@@ -28,7 +28,7 @@
{% endblock %} diff -rupN admin/templates/admin/object_history.html /home/kyle/django/contrib/admin/templates/admin/object_history.html --- admin/templates/admin/object_history.html 2009-01-29 22:05:47.000000000 -0700 +++ /home/kyle/django/contrib/admin/templates/admin/object_history.html 2009-01-08 22:05:47.000000000 -0700 @@ -28,7 +28,7 @@ {% for action in action_list %} {{ action.action_time|date:_("DATETIME_FORMAT") }} - {{ action.user.username }}{% if action.user.first_name %} ({{ action.user.first_name }} {{ action.user.last_name }}){% endif %} + {{ action.user.email }}{% if action.user.first_name %} ({{ action.user.first_name }} {{ action.user.last_name }}){% endif %} {{ action.change_message }} {% endfor %} diff -rupN admin/templates/registration/password_reset_email.html /home/kyle/django/contrib/admin/templates/registration/password_reset_email.html --- admin/templates/registration/password_reset_email.html 2009-01-29 22:05:47.000000000 -0700 +++ /home/kyle/django/contrib/admin/templates/registration/password_reset_email.html 2009-01-08 22:05:47.000000000 -0700 @@ -6,7 +6,6 @@ {% block reset_link %} {{ protocol }}://{{ domain }}{% url django.contrib.auth.views.password_reset_confirm uidb36=uid, token=token %} {% endblock %} -{% trans "Your username, in case you've forgotten:" %} {{ user.username }} {% trans "Thanks for using our site!" %} diff -rupN admin/views/decorators.py /home/kyle/django/contrib/admin/views/decorators.py --- admin/views/decorators.py 2009-01-29 22:05:47.000000000 -0700 +++ /home/kyle/django/contrib/admin/views/decorators.py 2009-01-29 22:00:17.000000000 -0700 @@ -55,15 +55,6 @@ def staff_member_required(view_func): user = authenticate(username=username, password=password) if user is None: message = ERROR_MESSAGE - if '@' in username: - # Mistakenly entered e-mail address instead of username? Look it up. - users = list(User.objects.filter(email=username)) - if len(users) == 1 and users[0].check_password(password): - message = _("Your e-mail address is not your username. Try '%s' instead.") % users[0].username - else: - # Either we cannot find the user, or if more than 1 - # we cannot guess which user is the correct one. - message = _("Usernames cannot contain the '@' character.") return _display_login_form(request, message) # The user data is correct; log in the user in and continue.