request param on password reset view.
3 files changed, 13 insertions(+), 6 deletions(-)

M webutils/baseacct/models.py
M webutils/baseacct/views.py
M webutils/djtools/email.py
M webutils/baseacct/models.py +5 -3
@@ 15,13 15,14 @@ class BaseUserProfileManager(UserManager
         random_string = User.objects.make_random_password()
         return hashlib.sha1((salt + random_string).encode('utf-8')).hexdigest()
 
-    def send_user_email(self, user, subject, context, template):
+    def send_user_email(self, user, subject, context, template, request=None):
         send_simple_email(
             user.email,
             subject,
             context,
             template,
             is_template_file=True,
+            request=request,
         )
 
     def add_new_user(self, username, password, email, first_name, last_name):

          
@@ 34,7 35,7 @@ class BaseUserProfileManager(UserManager
         # User Profile
         return self.create(user=new_user)
 
-    def reset_user_password(self, key):
+    def reset_user_password(self, key, request=None):
         import re
 
         if re.match('^[a-f0-9]{40}$', key):

          
@@ 59,7 60,8 @@ class BaseUserProfileManager(UserManager
                 user,
                 subject,
                 ctext,
-                'baseacct/reset_email_done.txt'
+                'baseacct/reset_email_done.txt',
+                request=request,
             )
             return user
         return False

          
M webutils/baseacct/views.py +5 -1
@@ 38,6 38,7 @@ def reset(request, reset_form, profile_m
                 subject,
                 ctext,
                 'baseacct/reset_email.txt',
+                request=request,
             )
 
             msg = ('An email has been sent to %s. Please follow the '

          
@@ 50,7 51,10 @@ def reset(request, reset_form, profile_m
             })
     else:
         if key is not None:
-            user = profile_model.objects.reset_user_password(key)
+            user = profile_model.objects.reset_user_password(
+                key,
+                request=request,
+            )
             if user:
                 msg = ('We have reset your password. You will receive an '
                        'email shortly containing your new password. Use '

          
M webutils/djtools/email.py +3 -2
@@ 4,7 4,8 @@ from django.template import Template, lo
 
 
 def send_simple_email(recip, subject, context, template, from_email=None,
-                      is_template_file=True, fail_silently=False):
+                      is_template_file=True, fail_silently=False,
+                      request=None):
     if is_template_file:
         # Load template from actual file in templates dir
         msg_template = loader.get_template(template)

          
@@ 14,7 15,7 @@ def send_simple_email(recip, subject, co
 
     msg_dict = {
         'from_email': from_email or settings.DEFAULT_FROM_EMAIL,
-        'message': msg_template.render(context),
+        'message': msg_template.render(context, request),
         'recipient_list': isinstance(recip, list) and recip or [recip],
         'subject': subject,
     }