I'm attempting to override the default password reset email to send an HTML email, but I cannot find documentation on this.
I added my template to templates/account/email/password_reset_key_message.html, but that didn't override the default.
What is the proper and concise way to do this?
Related https://github.com/pennersr/django-allauth/issues/682
@pennersr - I just hit this too and was thinking of putting in a pull request for a possible override in settings. That way, there's no need to subclass the default adapter just for the sake of a single email template swap.
Let me know if that'd be acceptable as a PR.
@chdsbd - Looks like you'll have to override the default adapter's send_confirmation_email method, which in turn feeds the prefix into the render_email method
CC: @StevenFerreira
Alternatively, you could do a template override in your local django project template directory, and use the exact same naming convention.
https://docs.djangoproject.com/en/1.11/howto/overriding-templates/#overriding-from-the-project-s-templates-directory
I am trying to do this, and it works for the verify confirmation email, but it seems that the reset password email is still using the default templates/registration/password_reset_email.html, and it doesn't hit the render_email function, or any of the email functions in the AccountAdaptor.
I am a bit at a loss.
Here is the way I previously changed the default AccountAdapter to send a custom url
https://github.com/Tivix/django-rest-auth/issues/389#issuecomment-350487890
You need to create your own PasswordResetSerializer with a custom save method and override the default in the settings.
Check out this solution here:
https://stackoverflow.com/a/52111127/7234587
To make an HTML email simply replace 'email_template_name' with 'html_email_template_name' in the save options. Then use an HTML file instead of a text file.
If you dont need to use HTML just create a file called password_reset_key_message.txt in templates/account/email and it will work.
Two more cents here watch out for the actual reset password URL syntax
https://github.com/django/django/blob/master/django/contrib/admin/templates/registration/password_reset_email.html#L6
It may change in the future.
In case anyone is looking at this, works for me just by changing password_reset_key_message.txt and password_reset_key_subject.txt to have ".html" extensions.
Most helpful comment
I am trying to do this, and it works for the verify confirmation email, but it seems that the reset password email is still using the default templates/registration/password_reset_email.html, and it doesn't hit the render_email function, or any of the email functions in the AccountAdaptor.
I am a bit at a loss.
Here is the way I previously changed the default AccountAdapter to send a custom url
https://github.com/Tivix/django-rest-auth/issues/389#issuecomment-350487890