Commits

Anonymous committed 86d8460

Fixed #8131: use reverse() in auth views. Patch from davenaff.

  • Participants
  • Parent commits 9198ac7

Comments (0)

Files changed (1)

File django/contrib/auth/views.py

 from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm, PasswordChangeForm, AdminPasswordChangeForm
 from django.contrib.auth.tokens import default_token_generator
 from django.core.exceptions import PermissionDenied
+from django.core.urlresolvers import reverse
 from django.shortcuts import render_to_response, get_object_or_404
 from django.contrib.sites.models import Site, RequestSite
 from django.http import HttpResponseRedirect, Http404
                 if not Site._meta.installed:
                     opts['domain_override'] = RequestSite(request).domain
             form.save(**opts)
-            return HttpResponseRedirect('%sdone/' % request.path)
+            return HttpResponseRedirect(reverse('django.contrib.auth.views.password_reset_done'))
     else:
         form = password_reset_form()
     return render_to_response(template_name, {
             form = set_password_form(user, request.POST)
             if form.is_valid():
                 form.save()
-                return HttpResponseRedirect("../done/")
+                return HttpResponseRedirect(reverse('django.contrib.auth.views.password_reset_complete'))
         else:
             form = set_password_form(None)
     else:
         form = PasswordChangeForm(request.user, request.POST)
         if form.is_valid():
             form.save()
-            return HttpResponseRedirect('%sdone/' % request.path)
+            return HttpResponseRedirect(reverse('django.contrib.auth.views.password_change_done'))
     else:
         form = PasswordChangeForm(request.user)
     return render_to_response(template_name, {