Ticket #12372: request-email.diff
File request-email.diff, 2.4 KB (added by , 15 years ago) |
---|
-
django/contrib/auth/views.py
78 78 # 4 views for password reset: 79 79 # - password_reset sends the mail 80 80 # - 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 82 82 # prompts for a new password 83 83 # - password_reset_complete shows a success message for the above 84 84 … … 101 101 opts['email_template_name'] = email_template_name 102 102 if not Site._meta.installed: 103 103 opts['domain_override'] = RequestSite(request).domain 104 form.save( **opts)104 form.save(request, **opts) 105 105 return HttpResponseRedirect(post_reset_redirect) 106 106 else: 107 107 form = password_reset_form() -
django/contrib/auth/forms.py
47 47 username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^\w+$', 48 48 help_text = _("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."), 49 49 error_message = _("This value must contain only letters, numbers and underscores.")) 50 50 51 51 class Meta: 52 52 model = User 53 53 … … 109 109 raise forms.ValidationError(_("That e-mail address doesn't have an associated user account. Are you sure you've registered?")) 110 110 return email 111 111 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', 113 113 use_https=False, token_generator=default_token_generator): 114 114 """ 115 115 Generates a one-use only link for resetting password and sends to the user … … 131 131 'user': user, 132 132 'token': token_generator.make_token(user), 133 133 'protocol': use_https and 'https' or 'http', 134 'request': request, 134 135 } 135 136 send_mail(_("Password reset on %s") % site_name, 136 137 t.render(Context(c)), None, [user.email])