0

I am trying to add a user reg system to my Django site. Obviously, I want to use the built-in auth views and forms. I am going about implementing the auth password reset process. It works fine up to sending the email, but then does not redirect properly. The end result is the password reset done email being sent over and over and over. I am overriding the templates, but nothing else, right now all they have is:

{{form.As_p}}

I have changed my urls.py to use the auth.views as such:

from django.contrib.auth import views as auth_views

(r'^account/forgot/$',
 auth_views.password_reset, 
 {'template_name': 'registration/password_reset.html',
  'post_reset_redirect':'/account/password-reset-done'}
),
(r'^account/password-reset-done/$',
 auth_views.password_reset_done,
 {'template_name': 'registration/password_reset_done.html'}
),
Duncan Parkes
  • 1,902
  • 1
  • 15
  • 24
picus
  • 1,507
  • 2
  • 13
  • 23

1 Answers1

1

It looks to me as though you need a trailing slash on the post_reset_redirect url. Have you tried that? At the moment, /account/password-reset-done won't match r'^account/password-reset-done/$' because the / in that is compulsory.

See example request 4 in the Django url dispatcher documentation: https://docs.djangoproject.com/en/dev/topics/http/urls/#example

Duncan Parkes
  • 1,902
  • 1
  • 15
  • 24
  • That makes sense, but it only seemed to be happening because the user I was testing had the same email address as another user. +1 for the answer. But I think I need to use the answer on this issue to enforce uniqueness: http://stackoverflow.com/questions/1160030/how-to-make-email-field-unique-in-model-user-from-contrib-auth-in-django The loop issue I was experiencing is kind of a big deal, I would imagine. Maybe I will post it in Django's bug tracker. It was happening on an OSX test environment running the virtual server. Thanks. – picus Oct 16 '12 at 13:04