Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #20532 -- Reverse auth views by name, not by path.

Auth views should be reversed by name, not their locations in
`django.contrib.auth.views`. This allows substituting your own
implementations of the auth views.
  • Loading branch information...
commit 4f4e9243e4cf585e32a882804084853108ef94c0 1 parent c36b75c
@gavinwahl gavinwahl authored charettes committed
View
2  django/contrib/admin/templates/registration/password_reset_email.html
@@ -3,7 +3,7 @@
{% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %}
-{{ protocol }}://{{ domain }}{% url 'django.contrib.auth.views.password_reset_confirm' uidb36=uid token=token %}
+{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb36=uid token=token %}
{% endblock %}
{% trans "Your username, in case you've forgotten:" %} {{ user.get_username }}
View
6 django/contrib/auth/tests/test_views.py
@@ -404,7 +404,7 @@ def test_password_change_redirect_custom_named(self):
class LoginTest(AuthViewsTestCase):
def test_current_site_in_context_after_login(self):
- response = self.client.get(reverse('django.contrib.auth.views.login'))
+ response = self.client.get(reverse('login'))
self.assertEqual(response.status_code, 200)
if Site._meta.installed:
site = Site.objects.get_current()
@@ -416,7 +416,7 @@ def test_current_site_in_context_after_login(self):
'Login form is not an AuthenticationForm')
def test_security_check(self, password='password'):
- login_url = reverse('django.contrib.auth.views.login')
+ login_url = reverse('login')
# Those URLs should not pass the security check
for bad_url in ('http://example.com',
@@ -631,7 +631,7 @@ def test_logout_with_named_redirect(self):
self.confirm_logged_out()
def test_security_check(self, password='password'):
- logout_url = reverse('django.contrib.auth.views.logout')
+ logout_url = reverse('logout')
# Those URLs should not pass the security check
for bad_url in ('http://example.com',
View
6 django/contrib/auth/views.py
@@ -142,7 +142,7 @@ def password_reset(request, is_admin_site=False,
current_app=None,
extra_context=None):
if post_reset_redirect is None:
- post_reset_redirect = reverse('django.contrib.auth.views.password_reset_done')
+ post_reset_redirect = reverse('password_reset_done')
else:
post_reset_redirect = resolve_url(post_reset_redirect)
if request.method == "POST":
@@ -197,7 +197,7 @@ def password_reset_confirm(request, uidb36=None, token=None,
UserModel = get_user_model()
assert uidb36 is not None and token is not None # checked by URLconf
if post_reset_redirect is None:
- post_reset_redirect = reverse('django.contrib.auth.views.password_reset_complete')
+ post_reset_redirect = reverse('password_reset_complete')
else:
post_reset_redirect = resolve_url(post_reset_redirect)
try:
@@ -249,7 +249,7 @@ def password_change(request,
password_change_form=PasswordChangeForm,
current_app=None, extra_context=None):
if post_change_redirect is None:
- post_change_redirect = reverse('django.contrib.auth.views.password_change_done')
+ post_change_redirect = reverse('password_change_done')
else:
post_change_redirect = resolve_url(post_change_redirect)
if request.method == "POST":
Please sign in to comment.
Something went wrong with that request. Please try again.