Code

Ticket #8131: auth_reverse.diff

File auth_reverse.diff, 1.8 KB (added by davenaff, 6 years ago)
Line 
1Index: contrib/auth/views.py
2===================================================================
3--- contrib/auth/views.py       (revision 8207)
4+++ contrib/auth/views.py       (working copy)
5@@ -5,6 +5,7 @@
6 from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm, PasswordChangeForm, AdminPasswordChangeForm
7 from django.contrib.auth.tokens import default_token_generator
8 from django.core.exceptions import PermissionDenied
9+from django.core.urlresolvers import reverse
10 from django.shortcuts import render_to_response, get_object_or_404
11 from django.contrib.sites.models import Site, RequestSite
12 from django.http import HttpResponseRedirect, Http404
13@@ -90,7 +91,7 @@
14                 if not Site._meta.installed:
15                     opts['domain_override'] = RequestSite(request).domain
16             form.save(**opts)
17-            return HttpResponseRedirect('%sdone/' % request.path)
18+            return HttpResponseRedirect(reverse('django.contrib.auth.views.password_reset_done'))
19     else:
20         form = password_reset_form()
21     return render_to_response(template_name, {
22@@ -121,7 +122,7 @@
23             form = set_password_form(user, request.POST)
24             if form.is_valid():
25                 form.save()
26-                return HttpResponseRedirect("../done/")
27+                return HttpResponseRedirect(reverse('django.contrib.auth.views.password_reset_complete'))
28         else:
29             form = set_password_form(None)
30     else:
31@@ -139,7 +140,7 @@
32         form = PasswordChangeForm(request.user, request.POST)
33         if form.is_valid():
34             form.save()
35-            return HttpResponseRedirect('%sdone/' % request.path)
36+            return HttpResponseRedirect(reverse('django.contrib.auth.views.password_change_done'))
37     else:
38         form = PasswordChangeForm(request.user)
39     return render_to_response(template_name, {