dj-rest-auth
dj-rest-auth copied to clipboard
Passwort reset email template not found.
I recently upgraded from version 2.1.4
to version 2.2.2
. Everything works fine except my custom passwort reset email template is not found anymore. Instead of this template, the default passwort reset email template is used. The path to the template is correct, as it is detected correctly in version 2.1.4
.
Here is my CustomPasswordResetSerializer which is registered in settings.py
:
from dj_rest_auth.serializers import PasswordResetSerializer
class CustomPasswordResetSerializer(PasswordResetSerializer):
def get_email_options(self):
return {
"html_email_template_name": "registration/password_reset_message.html",
}
It seems that this is causing this misbehaviour:
def password_reset_form_class(self):
if 'allauth' in settings.INSTALLED_APPS:
return AllAuthPasswordResetForm
else:
return PasswordResetForm
The PasswordResetForm
uses your get_email_option
, therefore it uses also your template. If you have "allauth" in your installed apps, the AllAuthPasswordResetForm
is used, and this won't access your get_email_options
function. Here the path to the email template is hardcoded to account/email/password_reset_key
.
Not sure if this is a intended behaviour. If yes, what is the alternative to choose a custom path for the template?
I moved and renamed my html template to account/email/password_reset_key_message.html
and I also changed to path in the get_email_options
method of my CustomPasswordResetSerializer
. The template is now recognized correctly, and an email is sent, but the required uid
and token
variables which should be passed to the template are not set. Therefore the link is not valid.
I've run also into this issue. I downgraded again to 2.1.4
.
I moved and renamed my html template to
account/email/password_reset_key_message.html
and I also changed to path in theget_email_options
method of myCustomPasswordResetSerializer
. The template is now recognized correctly, and an email is sent, but the requireduid
andtoken
variables which should be passed to the template are not set. Therefore the link is not valid.
Hey,
We are facing the same issue, were you able to find a workaround?
Downgrading was the only solution for me