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
This commit is contained in:
ichuang
2012-06-26 23:00:25 -04:00
parent fee4ecf742
commit 200e188c09
5 changed files with 15 additions and 5 deletions

View File

@@ -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())

View File

@@ -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

View File

@@ -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'
#-----------------------------------------------------------------------------

View File

@@ -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'
#-----------------------------------------------------------------------------

View File

@@ -1,7 +1,7 @@
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 }