summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorsujayskumar <sujay.skumar141295@gmail.com>2015-06-18 18:19:35 +0530
committerTim Graham <timograham@gmail.com>2015-09-18 18:56:04 -0400
commitd8d853378b3ff75c03d8bd91ea026d2b8c642b0f (patch)
tree2940f0b5eff6cef6848da60ad7c22acf63f43447 /django
parentaac2a2d2ae2486342058db0c72ed7ba2c7c8eb1e (diff)
Fixed #24944 -- Added extra_email_context parameter to password_reset() view.
Diffstat (limited to 'django')
-rw-r--r--django/contrib/auth/forms.py6
-rw-r--r--django/contrib/auth/views.py4
2 files changed, 7 insertions, 3 deletions
diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py
index 8d0dacb3bb..b1cedc916c 100644
--- a/django/contrib/auth/forms.py
+++ b/django/contrib/auth/forms.py
@@ -229,7 +229,8 @@ class PasswordResetForm(forms.Form):
subject_template_name='registration/password_reset_subject.txt',
email_template_name='registration/password_reset_email.html',
use_https=False, token_generator=default_token_generator,
- from_email=None, request=None, html_email_template_name=None):
+ from_email=None, request=None, html_email_template_name=None,
+ extra_email_context=None):
"""
Generates a one-use only link for resetting password and sends to the
user.
@@ -251,7 +252,8 @@ class PasswordResetForm(forms.Form):
'token': token_generator.make_token(user),
'protocol': 'https' if use_https else 'http',
}
-
+ if extra_email_context is not None:
+ context.update(extra_email_context)
self.send_mail(subject_template_name, email_template_name,
context, from_email, user.email,
html_email_template_name=html_email_template_name)
diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py
index 8bc4c0c980..2c39d0f018 100644
--- a/django/contrib/auth/views.py
+++ b/django/contrib/auth/views.py
@@ -175,7 +175,8 @@ def password_reset(request, is_admin_site=False,
post_reset_redirect=None,
from_email=None,
extra_context=None,
- html_email_template_name=None):
+ html_email_template_name=None,
+ extra_email_context=None):
if post_reset_redirect is None:
post_reset_redirect = reverse('password_reset_done')
else:
@@ -191,6 +192,7 @@ def password_reset(request, is_admin_site=False,
'subject_template_name': subject_template_name,
'request': request,
'html_email_template_name': html_email_template_name,
+ 'extra_email_context': extra_email_context,
}
if is_admin_site:
warnings.warn(