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

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8334 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2008-08-12 23:31:31 +00:00
parent bfac0b7385
commit bb30805452
1 changed files with 4 additions and 3 deletions

View File

@ -5,6 +5,7 @@ from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm, PasswordChangeForm, AdminPasswordChangeForm from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm, PasswordChangeForm, AdminPasswordChangeForm
from django.contrib.auth.tokens import default_token_generator from django.contrib.auth.tokens import default_token_generator
from django.core.exceptions import PermissionDenied 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.shortcuts import render_to_response, get_object_or_404
from django.contrib.sites.models import Site, RequestSite from django.contrib.sites.models import Site, RequestSite
from django.http import HttpResponseRedirect, Http404 from django.http import HttpResponseRedirect, Http404
@ -90,7 +91,7 @@ def password_reset(request, is_admin_site=False, template_name='registration/pas
if not Site._meta.installed: if not Site._meta.installed:
opts['domain_override'] = RequestSite(request).domain opts['domain_override'] = RequestSite(request).domain
form.save(**opts) form.save(**opts)
return HttpResponseRedirect('%sdone/' % request.path) return HttpResponseRedirect(reverse('django.contrib.auth.views.password_reset_done'))
else: else:
form = password_reset_form() form = password_reset_form()
return render_to_response(template_name, { return render_to_response(template_name, {
@ -121,7 +122,7 @@ def password_reset_confirm(request, uidb36=None, token=None, template_name='regi
form = set_password_form(user, request.POST) form = set_password_form(user, request.POST)
if form.is_valid(): if form.is_valid():
form.save() form.save()
return HttpResponseRedirect("../done/") return HttpResponseRedirect(reverse('django.contrib.auth.views.password_reset_complete'))
else: else:
form = set_password_form(None) form = set_password_form(None)
else: else:
@ -139,7 +140,7 @@ def password_change(request, template_name='registration/password_change_form.ht
form = PasswordChangeForm(request.user, request.POST) form = PasswordChangeForm(request.user, request.POST)
if form.is_valid(): if form.is_valid():
form.save() form.save()
return HttpResponseRedirect('%sdone/' % request.path) return HttpResponseRedirect(reverse('django.contrib.auth.views.password_change_done'))
else: else:
form = PasswordChangeForm(request.user) form = PasswordChangeForm(request.user)
return render_to_response(template_name, { return render_to_response(template_name, {