Opened 5 weeks ago
Closed 5 weeks ago
#36110 closed New feature (wontfix)
Unable to customize kwargs passed to PasswordResetForm EmailMultiAlternatives
Reported by: | Claude Paroz | Owned by: | Antoliny |
---|---|---|---|
Component: | contrib.auth | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Use case: you'd like to add a Reply-To header to the password reset message.
To do that currently, you have no other choice than to rewrite the whole PasswordResetForm.send_mail
method. I think a hook is needed to be able to define any other EmailMultiAlternatives init arguments.
Change History (6)
comment:1 by , 5 weeks ago
comment:2 by , 5 weeks ago
Keywords: | email added |
---|---|
Owner: | set to |
Status: | new → assigned |
May I work on this issue? If you decide to take it on, feel free to unassign me. 😃
comment:4 by , 5 weeks ago
The use case was mentioned in #17431 where PasswordResetForm.send_mail()
was added. I agree it's not so nice to have to override the entire method, however, the test added in a00b78b1e2ac9bf271d55c1799138a27f5e0d03e adds Reply-To and does not look so ugly.
Also note that much this form's API is controlled in the view via form.save() kwargs. In light of that, it looks a bit out of place to add a method hook for the proposed purpose.
comment:5 by , 5 weeks ago
and does not look so ugly
However it hardcodes things to not look ugly!
it looks a bit out of place to add a method hook for the proposed purpose
Sure, the implementation could be different than the one I proposed. I'm not opposed to make the customization as a new form.save()
kwarg.
comment:6 by , 5 weeks ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
However it hardcodes things to not look ugly!
True, though I believe if you needed to overwrite send_mail
, it's probable that you can simplify and hard-code some logic (I might be wrong)
I am on the fence here, so would prefer for this to be discussed on the forum and see if there are other folks who are in favor of the change
Note I didn't pass through a forum post as I think the need is rather straightforward. You may disagree :-)
A possible implementation: