From 470f613b4488ff8fef96d4863a063efcc631819c Mon Sep 17 00:00:00 2001 From: Randy Ostler Date: Tue, 19 May 2015 09:59:59 -0400 Subject: [PATCH 1/2] Added Randy Ostler to AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 046f19df62..bbf29a91e0 100644 --- a/AUTHORS +++ b/AUTHORS @@ -212,3 +212,4 @@ Jolyon Bloomfield Kyle McCormick Jim Cai Richard Moch +Randy Ostler \ No newline at end of file From 93e6434e193783d4bc384b450031baf261dbf49a Mon Sep 17 00:00:00 2001 From: Randy Ostler Date: Tue, 19 May 2015 10:01:48 -0400 Subject: [PATCH 2/2] Create email message only when it will be sent --- common/djangoapps/student/views.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 278df30d88..5f110b577d 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -1537,17 +1537,6 @@ def create_account_with_params(request, params): create_comments_service_user(user) - context = { - 'name': profile.name, - 'key': registration.activation_key, - } - - # composes activation email - subject = render_to_string('emails/activation_email_subject.txt', context) - # Email subject *must not* contain newlines - subject = ''.join(subject.splitlines()) - message = render_to_string('emails/activation_email.txt', context) - # Don't send email if we are: # # 1. Doing load testing. @@ -1565,6 +1554,17 @@ def create_account_with_params(request, params): not (do_external_auth and settings.FEATURES.get('BYPASS_ACTIVATION_EMAIL_FOR_EXTAUTH')) ) if send_email: + context = { + 'name': profile.name, + 'key': registration.activation_key, + } + + # composes activation email + subject = render_to_string('emails/activation_email_subject.txt', context) + # Email subject *must not* contain newlines + subject = ''.join(subject.splitlines()) + message = render_to_string('emails/activation_email.txt', context) + from_address = microsite.get_value( 'email_from_address', settings.DEFAULT_FROM_EMAIL