Wednesday, November 28, 2012

Re: How to log a user in automatically after a password reset?

Option 1 doesn't hold much appeal, for all the reasons you mention.

Option 2 is a possibility, I suppose. Checking to see if password_reset_confirm returns an HttpRedirect is a possibility I hadn't considered.

Option 3 is intriguing. But this part has me scratching my head:
 
Then, write a method that has the same prototype as the constructor for the form that the password_reset_confirm() method is expecting, but returns an instance of *your* form, bound with the current request.
 
Okay, how could this method create a form bound with the current request? How is the method getting its mitts on the current request? The method is being passed to password_reset_confirm via the URL dispatcher – that is, I would need to have code like the following in my urls.py:

  url(r'^password/set/(?P<uidb36>\w+)/(?P<token>[-\w]+)',
    'password_reset_confirm', {
      'set_password_form': abracadabra_method,
    }),

Where does abracadabra_method get the current request?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/QtXySdQtInYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment