Customising password reset email for custom PasswordResetFromKeyView subclass without overriding the default templates #3945
Unanswered
tomdeabreucodes
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey there,
I'm trying to create a custom password reset flow, using
ResetPasswordForm
andPasswordResetFromKeyView
as a starting point. I do not want to completely override the existing email templates, because the use case is slightly different and I want to retain the defaults, so I would prefer to feed in my custom email template only when my custom view is accessed, similar to how you can with django'sPasswordResetConfirmView
by overridingemail_template_name
.I cannot find a simple way to achieve this in allauth, and wondering if I'm missing something. I saw that there is the
get_reset_password_from_key_url
method, but that seemingly only gives access to override the URL in the email.The simplest way I can think of, still taking advantage of a custom AccountAdapter is to override the
send_mail
method, and applying some logic on the context to inject my custom email template if a condition is met.Is there a more straightforward way to achieve this? And are there any issues/risks with taking this approach?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions