Wednesday, October 7, 2015

Re: Possible Bug in password_reset_form

You could create a custom view function that wraps password_reset() and adds a RequestContext.

On Wednesday, October 7, 2015 at 1:05:12 PM UTC-4, Mike Widman wrote:
Thank you. 

I am not sure that solves the problem though (or I just don't understand how to do this): If I am calling password_reset directly from my urls, how do I pass a requestContext into the "extra_email_context"?  There is no request sent to "render_to_string" so the RequestContext would need to be created before that point, which either requires subclassing PasswordResetForm's save function or somehow getting access to the request in urls.py to build a RequestContext. 

Regards,
  Mike


On Monday, October 5, 2015 at 4:11:59 PM UTC-7, Tim Graham wrote:
In Django 1.9, the "extra_email_context" parameter was added to achieve this.

https://docs.djangoproject.com/en/1.9/topics/auth/default/#django.contrib.auth.views.password_reset

On Monday, October 5, 2015 at 5:48:57 PM UTC-4, mwidman wrote:
Not sure if this intentional or not, but in Django 1.8.4 the PasswordResetForm's save function only passes a dictionary as the context to "send_mail()".

Because of that, there is now way to add any extra information (i.e. from a RequestContext). 

Can anyone say if this is done for some security reason or if the context dictionary should be made into a RequestContext via "make_context"?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/06e26a9c-3fe5-4c54-984f-618ccfc1c658%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment