Ticket #2375: email_template.patch
File email_template.patch, 2.2 KB (added by , 18 years ago) |
---|
-
contrib/auth/views.py
50 50 "Redirects the user to the login page, passing the given 'next' page" 51 51 return HttpResponseRedirect('%s?%s=%s' % (login_url, REDIRECT_FIELD_NAME, next)) 52 52 53 def password_reset(request, is_admin_site=False, template_name='registration/password_reset_form.html' ):53 def password_reset(request, is_admin_site=False, template_name='registration/password_reset_form.html', email_template_name='registration/password_reset_email.html'): 54 54 new_data, errors = {}, {} 55 55 form = PasswordResetForm() 56 56 if request.POST: … … 58 58 errors = form.get_validation_errors(new_data) 59 59 if not errors: 60 60 if is_admin_site: 61 form.save( request.META['HTTP_HOST'])61 form.save(domain_override=request.META['HTTP_HOST']) 62 62 else: 63 form.save( )63 form.save(email_template=email_template_name) 64 64 return HttpResponseRedirect('%sdone/' % request.path) 65 65 return render_to_response(template_name, {'form': forms.FormWrapper(form, new_data, errors)}, 66 66 context_instance=RequestContext(request)) -
contrib/auth/forms.py
61 61 except User.DoesNotExist: 62 62 raise validators.ValidationError, "That e-mail address doesn't have an associated user acount. Are you sure you've registered?" 63 63 64 def save(self, domain_override=None):64 def save(self, email_template, domain_override=None): 65 65 "Calculates a new password randomly and sends it to the user" 66 66 from django.core.mail import send_mail 67 67 new_pass = User.objects.make_random_password() … … 73 73 domain = current_site.domain 74 74 else: 75 75 site_name = domain = domain_override 76 t = loader.get_template( 'registration/password_reset_email.html')76 t = loader.get_template(email_template) 77 77 c = { 78 78 'new_password': new_pass, 79 79 'email': self.user_cache.email,