Add support for sending email with html content when password change
KomeijiSatori opened this issue · 10 comments
It seems that for now when change the password, the confirm email is sent with plain text rather than html. From the official document here, the default method won't send html email. So can you override the origin method in the next release?
Thank you very much for your effort.
@KomeijiSatori Would you be able to submit a PR to handle this? It should be relatively simple to add the template for https://github.com/macropin/django-registration/blob/master/registration/templates/registration/password_reset_email.html to the view
@joshblum Do you mean I can extends the PasswordResetView
and set the html_email_template_name
field to the template name?
And what about Django <= 1.10? So should I create a new method to call the password_reset
method with parameter html_email_template_name
be set?
You can pass in a kwarg to the call to as_view
for the PasswordResetView
and for Django <= 1.10 you can pass in the template name as follows:
url(r'^password/reset/$',
auth_views.password_reset,
{'post_reset_redirect': reverse_lazy('auth_password_reset_done'),
'html_email_template_name': 'registration/password_reset_email.html',
}, name='auth_password_reset'),
Although on second thought it might be best to leave the Django defaults in the library and to include the html template in your local installation (You can choose to not include the default auth urls and put your own custom ones in.) I'll defer to @dicato or @macropin for what to do with the library.
Cool, It seems to work. In that way developers can write their own urls or overwrite the default urls to meet their needs.
But it seems not friendly to new developers who don't know the trick, since refer to the official doc is kind of time consuming. It will be better to set a flag in settings whether password_reset_email should be html.
Thank you very much for helping me!
Instead of a settings flag, do you want to submit a PR that adds an example to the docs for future developers to use?
That's OK, but which file should I add examples to?
OK, but it seems I don't have permission to create a pull request
@KomeijiSatori this should help! https://help.github.com/articles/creating-a-pull-request-from-a-fork/ let me know if you run into any issues