Commit 200e188c by ichuang

add MITX_FEATURES['REROUTE_ACTIVATION_EMAIL'] config for edx4edx activation

 - issue is that content machine isn't whitelisted for email
 - this also provides secondary filtering for user registration
parent fee4ecf7
......@@ -191,7 +191,9 @@ def create_account(request, post_override=None):
up.save()
d={'name':post_vars['name'],
'key':r.activation_key}
'key':r.activation_key,
'course_title' : settings.COURSE_TITLE,
}
subject = render_to_string('emails/activation_email_subject.txt',d)
# Email subject *must not* contain newlines
......@@ -199,7 +201,11 @@ def create_account(request, post_override=None):
message = render_to_string('emails/activation_email.txt',d)
try:
if not settings.GENERATE_RANDOM_USER_CREDENTIALS:
if settings.MITX_FEATURES.get('REROUTE_ACTIVATION_EMAIL',''):
dest_addr = settings.MITX_FEATURES['REROUTE_ACTIVATION_EMAIL']
message = "Activation for %s (%s): %s\n" % (u,u.email,up.name) + '-'*80 + '\n\n' + message
send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [dest_addr], fail_silently=False)
elif not settings.GENERATE_RANDOM_USER_CREDENTIALS:
res=u.email_user(subject, message, settings.DEFAULT_FROM_EMAIL)
except:
log.exception(sys.exc_info())
......
......@@ -38,6 +38,7 @@ MITX_FEATURES = {
'SAMPLE' : False,
'USE_DJANGO_PIPELINE' : True,
'DISPLAY_HISTOGRAMS_TO_STAFF' : True,
'REROUTE_ACTIVATION_EMAIL' : False, # nonempty string = address for all activation emails
}
# Used for A/B testing
......
......@@ -24,6 +24,7 @@ if 'eecs1' in socket.gethostname():
# edx4edx content server
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
MITX_FEATURES['REROUTE_ACTIVATION_EMAIL'] = 'ichuang@mit.edu'
#EMAIL_BACKEND = 'django_ses.SESBackend'
#-----------------------------------------------------------------------------
......
......@@ -24,6 +24,8 @@ if 'eecs1' in socket.gethostname():
# edx4edx content server
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
MITX_FEATURES['REROUTE_ACTIVATION_EMAIL'] = 'ichuang@mit.edu'
#EMAIL_BACKEND = 'django_ses.SESBackend'
#-----------------------------------------------------------------------------
......
Someone, hopefully you, signed up for an account for MITx's on-line
offering of 6.002 using this email address. If it was you, and you'd
like to activate and use your account, copy and paste this address
into your web browser's address bar:
offering of "${ course_title}" using this email address. If it was
you, and you'd like to activate and use your account, copy and paste
this address into your web browser's address bar:
% if is_secure:
https://${ site }/activate/${ key }
......
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