diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py
index 050fc19..5722ec6 100644
a
|
b
|
class AuthenticationForm(forms.Form):
|
196 | 196 | |
197 | 197 | class PasswordResetForm(forms.Form): |
198 | 198 | email = forms.EmailField(label=_("Email"), max_length=254) |
| 199 | # The user attibute that stores the email address. |
| 200 | EMAIL_FIELD = 'email' |
199 | 201 | |
200 | 202 | def send_mail(self, subject_template_name, email_template_name, |
201 | 203 | context, from_email, to_email, html_email_template_name=None): |
… |
… |
class PasswordResetForm(forms.Form):
|
220 | 222 | This allows subclasses to more easily customize the default policies |
221 | 223 | that prevent inactive users and users with unusable passwords from |
222 | 224 | resetting their password. |
223 | | |
224 | 225 | """ |
225 | | active_users = get_user_model()._default_manager.filter( |
226 | | email__iexact=email, is_active=True) |
| 226 | active_users = get_user_model()._default_manager.filter(**{ |
| 227 | '%s__iexact' % EMAIL_FIELD: mail, |
| 228 | 'is_active': True, |
| 229 | }) |
227 | 230 | return (u for u in active_users if u.has_usable_password()) |
228 | 231 | |
229 | 232 | def save(self, domain_override=None, |
… |
… |
class PasswordResetForm(forms.Form):
|
244 | 247 | else: |
245 | 248 | site_name = domain = domain_override |
246 | 249 | context = { |
247 | | 'email': user.email, |
| 250 | 'email': email, |
248 | 251 | 'domain': domain, |
249 | 252 | 'site_name': site_name, |
250 | 253 | 'uid': urlsafe_base64_encode(force_bytes(user.pk)), |
… |
… |
class PasswordResetForm(forms.Form):
|
254 | 257 | } |
255 | 258 | |
256 | 259 | self.send_mail(subject_template_name, email_template_name, |
257 | | context, from_email, user.email, |
| 260 | context, from_email, email, |
258 | 261 | html_email_template_name=html_email_template_name) |
259 | 262 | |
260 | 263 | |