Commit 51d85809 by Douglas Hall

Fix default from email lookups

parent 7b86da02
...@@ -58,7 +58,7 @@ class PasswordResetFormNoActive(PasswordResetForm): ...@@ -58,7 +58,7 @@ class PasswordResetFormNoActive(PasswordResetForm):
email_template_name='registration/password_reset_email.html', email_template_name='registration/password_reset_email.html',
use_https=False, use_https=False,
token_generator=default_token_generator, token_generator=default_token_generator,
from_email=theming_helpers.get_value('default_from_email', settings.DEFAULT_FROM_EMAIL), from_email=theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL),
request=None request=None
): ):
""" """
......
...@@ -57,7 +57,7 @@ class EmailTestMixin(object): ...@@ -57,7 +57,7 @@ class EmailTestMixin(object):
email_user.assert_called_with( email_user.assert_called_with(
mock_render_to_string(subject_template, subject_context), mock_render_to_string(subject_template, subject_context),
mock_render_to_string(body_template, body_context), mock_render_to_string(body_template, body_context),
theming_helpers.get_value('default_from_email', settings.DEFAULT_FROM_EMAIL) theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
) )
def append_allowed_hosts(self, hostname): def append_allowed_hosts(self, hostname):
...@@ -298,7 +298,7 @@ class EmailChangeRequestTests(EventTestMixin, TestCase): ...@@ -298,7 +298,7 @@ class EmailChangeRequestTests(EventTestMixin, TestCase):
send_mail.assert_called_with( send_mail.assert_called_with(
mock_render_to_string('emails/email_change_subject.txt', context), mock_render_to_string('emails/email_change_subject.txt', context),
mock_render_to_string('emails/email_change.txt', context), mock_render_to_string('emails/email_change.txt', context),
theming_helpers.get_value('default_from_email', settings.DEFAULT_FROM_EMAIL), theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL),
[new_email] [new_email]
) )
self.assert_event_emitted( self.assert_event_emitted(
......
...@@ -125,7 +125,7 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase): ...@@ -125,7 +125,7 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase):
(subject, msg, from_addr, to_addrs) = send_email.call_args[0] (subject, msg, from_addr, to_addrs) = send_email.call_args[0]
self.assertIn("Password reset", subject) self.assertIn("Password reset", subject)
self.assertIn("You're receiving this e-mail because you requested a password reset", msg) self.assertIn("You're receiving this e-mail because you requested a password reset", msg)
self.assertEquals(from_addr, theming_helpers.get_value('default_from_email', settings.DEFAULT_FROM_EMAIL)) self.assertEquals(from_addr, theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL))
self.assertEquals(len(to_addrs), 1) self.assertEquals(len(to_addrs), 1)
self.assertIn(self.user.email, to_addrs) self.assertIn(self.user.email, to_addrs)
......
...@@ -2229,11 +2229,11 @@ def reactivation_email_for_user(user): ...@@ -2229,11 +2229,11 @@ def reactivation_email_for_user(user):
message = render_to_string('emails/activation_email.txt', context) message = render_to_string('emails/activation_email.txt', context)
try: try:
user.email_user(subject, message, theming_helpers.get_value('default_from_email', settings.DEFAULT_FROM_EMAIL)) user.email_user(subject, message, theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL))
except Exception: # pylint: disable=broad-except except Exception: # pylint: disable=broad-except
log.error( log.error(
u'Unable to send reactivation email from "%s"', u'Unable to send reactivation email from "%s"',
theming_helpers.get_value('default_from_email', settings.DEFAULT_FROM_EMAIL), theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL),
exc_info=True exc_info=True
) )
return JsonResponse({ return JsonResponse({
...@@ -2357,7 +2357,7 @@ def confirm_email_change(request, key): # pylint: disable=unused-argument ...@@ -2357,7 +2357,7 @@ def confirm_email_change(request, key): # pylint: disable=unused-argument
user.email_user( user.email_user(
subject, subject,
message, message,
theming_helpers.get_value('default_from_email', settings.DEFAULT_FROM_EMAIL) theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
) )
except Exception: # pylint: disable=broad-except except Exception: # pylint: disable=broad-except
log.warning('Unable to send confirmation email to old address', exc_info=True) log.warning('Unable to send confirmation email to old address', exc_info=True)
...@@ -2373,7 +2373,7 @@ def confirm_email_change(request, key): # pylint: disable=unused-argument ...@@ -2373,7 +2373,7 @@ def confirm_email_change(request, key): # pylint: disable=unused-argument
user.email_user( user.email_user(
subject, subject,
message, message,
theming_helpers.get_value('default_from_email', settings.DEFAULT_FROM_EMAIL) theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
) )
except Exception: # pylint: disable=broad-except except Exception: # pylint: disable=broad-except
log.warning('Unable to send confirmation email to new address', exc_info=True) log.warning('Unable to send confirmation email to new address', exc_info=True)
......
...@@ -389,7 +389,7 @@ def _get_source_address(course_id, course_title, truncate=True): ...@@ -389,7 +389,7 @@ def _get_source_address(course_id, course_title, truncate=True):
course_title=course_title_no_quotes, course_title=course_title_no_quotes,
course_name=course_name, course_name=course_name,
from_email=theming_helpers.get_value( from_email=theming_helpers.get_value(
'bulk_email_default_from_email', 'email_from_address',
settings.BULK_EMAIL_DEFAULT_FROM_EMAIL settings.BULK_EMAIL_DEFAULT_FROM_EMAIL
) )
) )
......
<%! from django.core.urlresolvers import reverse %> <%! from django.core.urlresolvers import reverse %>
<%! from django.utils.translation import ugettext as _ %> <%! from django.utils.translation import ugettext as _ %>
<%! from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value %>
${_("This is to confirm that you changed the e-mail associated with " ${_("This is to confirm that you changed the e-mail associated with "
"{platform_name} from {old_email} to {new_email}. If you " "{platform_name} from {old_email} to {new_email}. If you "
"did not make this request, please contact us immediately. Contact " "did not make this request, please contact us immediately. Contact "
"information is listed at:").format(platform_name=settings.PLATFORM_NAME, old_email=old_email, new_email=new_email)} "information is listed at:").format(
platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME),
old_email=old_email,
new_email=new_email
)
}
% if is_secure: % if is_secure:
https://${ site }${reverse('contact')} https://${ site }${reverse('contact')}
...@@ -11,5 +17,4 @@ ${_("This is to confirm that you changed the e-mail associated with " ...@@ -11,5 +17,4 @@ ${_("This is to confirm that you changed the e-mail associated with "
http://${ site }${reverse('contact')} http://${ site }${reverse('contact')}
% endif % endif
${_("We keep a log of old e-mails, so if this request was unintentional, we " ${_("We keep a log of old e-mails, so if this request was unintentional, we can investigate.")}
"can investigate.")}
...@@ -125,7 +125,7 @@ def send_credit_notifications(username, course_key): ...@@ -125,7 +125,7 @@ def send_credit_notifications(username, course_key):
notification_msg.attach(logo_image) notification_msg.attach(logo_image)
# add email addresses of sender and receiver # add email addresses of sender and receiver
from_address = theming_helpers.get_value('default_from_email', settings.DEFAULT_FROM_EMAIL) from_address = theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
to_address = user.email to_address = user.email
# send the root email message # send the root email message
......
...@@ -398,7 +398,7 @@ def request_password_change(email, orig_host, is_secure): ...@@ -398,7 +398,7 @@ def request_password_change(email, orig_host, is_secure):
# Generate a single-use link for performing a password reset # Generate a single-use link for performing a password reset
# and email it to the user. # and email it to the user.
form.save( form.save(
from_email=theming_helpers.get_value('default_from_email', settings.DEFAULT_FROM_EMAIL), from_email=theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL),
domain_override=orig_host, domain_override=orig_host,
use_https=is_secure use_https=is_secure
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment