diff --git a/django/contrib/auth/admin.py b/django/contrib/auth/admin.py
index 5e9ac9d..dbcf52d 100644
|
a
|
b
|
from django.shortcuts import get_object_or_404
|
| 11 | 11 | from django.template.response import TemplateResponse |
| 12 | 12 | from django.utils.html import escape |
| 13 | 13 | from django.utils.decorators import method_decorator |
| | 14 | from django.utils.safestring import mark_safe |
| 14 | 15 | from django.utils.translation import ugettext, ugettext_lazy as _ |
| 15 | 16 | from django.views.decorators.csrf import csrf_protect |
| 16 | 17 | from django.views.decorators.debug import sensitive_post_parameters |
| … |
… |
class UserAdmin(admin.ModelAdmin):
|
| 113 | 114 | extra_context) |
| 114 | 115 | |
| 115 | 116 | @sensitive_post_parameters() |
| 116 | | def user_change_password(self, request, id): |
| | 117 | def user_change_password(self, request, id, form_url=''): |
| 117 | 118 | if not self.has_change_permission(request): |
| 118 | 119 | raise PermissionDenied |
| 119 | 120 | user = get_object_or_404(self.model, pk=id) |
| … |
… |
class UserAdmin(admin.ModelAdmin):
|
| 133 | 134 | context = { |
| 134 | 135 | 'title': _('Change password: %s') % escape(user.username), |
| 135 | 136 | 'adminForm': adminForm, |
| | 137 | 'form_url': mark_safe(form_url), |
| 136 | 138 | 'form': form, |
| 137 | 139 | 'is_popup': '_popup' in request.REQUEST, |
| 138 | 140 | 'add': True, |
diff --git a/django/contrib/auth/fixtures/authtestdata.json b/django/contrib/auth/fixtures/authtestdata.json
index c286743..4e88a07 100644
|
a
|
b
|
|
| 52 | 52 | "email": "staffmember@example.com", |
| 53 | 53 | "date_joined": "2006-12-17 07:03:31" |
| 54 | 54 | } |
| | 55 | }, |
| | 56 | { |
| | 57 | "pk": "4", |
| | 58 | "model": "auth.user", |
| | 59 | "fields": { |
| | 60 | "username": "superuser", |
| | 61 | "first_name": "Superuser", |
| | 62 | "last_name": "Member", |
| | 63 | "is_active": true, |
| | 64 | "is_superuser": true, |
| | 65 | "is_staff": true, |
| | 66 | "last_login": "2006-12-17 07:03:31", |
| | 67 | "groups": [], |
| | 68 | "user_permissions": [], |
| | 69 | "password": "sha1$6efc0$f93efe9fd7542f25a7be94871ea45aa95de57161", |
| | 70 | "email": "superusermember@example.com", |
| | 71 | "date_joined": "2006-12-17 07:03:31" |
| | 72 | } |
| 55 | 73 | } |
| 56 | 74 | ] |
diff --git a/django/contrib/auth/tests/urls.py b/django/contrib/auth/tests/urls.py
index dbbd35e..f08e63b 100644
|
a
|
b
|
|
| 1 | | from django.conf.urls import patterns, url |
| | 1 | from django.conf.urls import patterns, url, include |
| 2 | 2 | from django.contrib.auth import context_processors |
| 3 | 3 | from django.contrib.auth.urls import urlpatterns |
| 4 | 4 | from django.contrib.auth.views import password_reset |
| … |
… |
from django.shortcuts import render_to_response
|
| 9 | 9 | from django.template import Template, RequestContext |
| 10 | 10 | from django.views.decorators.cache import never_cache |
| 11 | 11 | |
| | 12 | from django.contrib import admin |
| | 13 | admin.autodiscover() |
| | 14 | |
| 12 | 15 | @never_cache |
| 13 | 16 | def remote_user_auth_view(request): |
| 14 | 17 | "Dummy view for remote user tests" |
| … |
… |
urlpatterns = urlpatterns + patterns('',
|
| 60 | 63 | (r'^auth_processor_perms/$', auth_processor_perms), |
| 61 | 64 | (r'^auth_processor_messages/$', auth_processor_messages), |
| 62 | 65 | url(r'^userpage/(.+)/$', userpage, name="userpage"), |
| | 66 | url(r'^admin/', include(admin.site.urls)) |
| 63 | 67 | ) |
| 64 | 68 | |
diff --git a/django/contrib/auth/tests/views.py b/django/contrib/auth/tests/views.py
index 1975266..5b345bd 100644
|
a
|
b
|
class PasswordResetTest(AuthViewsTestCase):
|
| 183 | 183 | |
| 184 | 184 | class ChangePasswordTest(AuthViewsTestCase): |
| 185 | 185 | |
| | 186 | def test_form_url_present_in_context(self, password='password'): |
| | 187 | response = self.client.post('/login/', { |
| | 188 | 'username': 'superuser', |
| | 189 | 'password': password, |
| | 190 | }) |
| | 191 | |
| | 192 | response = self.client.get('/admin/auth/user/4/password/') |
| | 193 | self.assertEqual(response.status_code, 200) |
| | 194 | self.assertTrue('form_url' in response.context, msg = 'form_url not present in response context') |
| | 195 | |
| 186 | 196 | def fail_login(self, password='password'): |
| 187 | 197 | response = self.client.post('/login/', { |
| 188 | 198 | 'username': 'testclient', |