﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
17431	Allow PasswordResetForm subclasses full control over email message to send	Ethan Jucovy	jorgecarleitao	"The `django.contrib.auth.forms.PasswordResetForm` has logic to:

1. Validate that an active user exists with the email address provided
1. Generate an unguessable URL for the given user to reset his password using a timestamped token
1. Construct an email with a link to that URL
1. Send that email to the given user's email address

The `.save()` method of the form class is responsible for three of these four tasks.  The `.save()` method includes parameters for overriding the subject, body, and `From:` address of the email to be sent.  However, it's sometimes necessary to have more control over the email that will be sent.  These use cases could include:

1. BCC'ing a site administrator with a copy of the email sent
1. Setting a custom `Reply-To` like ""password-reset-help@example.com"" that is distinct from the message's `From:` address
1. Setting a `text/html` MIME type for the message, or using an `EmailMultiAlternatives` object to attach both text and HTML versions of the message

For all of these use cases, the knobs currently provided are insufficient, and require copying over all the logic in the `.save()` method.

The attached patch satisfies these use cases by allowing the user to subclass PasswordResetForm and override a `.construct_email()` method, whose job is to construct and return an `EmailMessage` to be sent by the `.save()` method.  The changes are fully backwards-compatible, and a test demonstrating the subclassing approach is provided."	New feature	closed	contrib.auth	dev	Normal	fixed		timograham@… jorgecarleitao	Accepted	1	1	0	0	0	0
