Ticket #12372: request-email.diff

File request-email.diff, 2.4 KB (added by Tim Miller, 15 years ago)
  • django/contrib/auth/views.py

     
    7878# 4 views for password reset:
    7979# - password_reset sends the mail
    8080# - password_reset_done shows a success message for the above
    81 # - password_reset_confirm checks the link the user clicked and 
     81# - password_reset_confirm checks the link the user clicked and
    8282#   prompts for a new password
    8383# - password_reset_complete shows a success message for the above
    8484
     
    101101                opts['email_template_name'] = email_template_name
    102102                if not Site._meta.installed:
    103103                    opts['domain_override'] = RequestSite(request).domain
    104             form.save(**opts)
     104            form.save(request, **opts)
    105105            return HttpResponseRedirect(post_reset_redirect)
    106106    else:
    107107        form = password_reset_form()
  • django/contrib/auth/forms.py

     
    4747    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^\w+$',
    4848        help_text = _("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."),
    4949        error_message = _("This value must contain only letters, numbers and underscores."))
    50    
     50
    5151    class Meta:
    5252        model = User
    5353
     
    109109            raise forms.ValidationError(_("That e-mail address doesn't have an associated user account. Are you sure you've registered?"))
    110110        return email
    111111
    112     def save(self, domain_override=None, email_template_name='registration/password_reset_email.html',
     112    def save(self, request=None, domain_override=None, email_template_name='registration/password_reset_email.html',
    113113             use_https=False, token_generator=default_token_generator):
    114114        """
    115115        Generates a one-use only link for resetting password and sends to the user
     
    131131                'user': user,
    132132                'token': token_generator.make_token(user),
    133133                'protocol': use_https and 'https' or 'http',
     134                'request': request,
    134135            }
    135136            send_mail(_("Password reset on %s") % site_name,
    136137                t.render(Context(c)), None, [user.email])
Back to Top