Update final copy recovery feature copy

This commit is contained in:
Saleem Latif
2019-02-01 15:22:06 +05:00
parent 7aa9ed5320
commit ecc86f9827
15 changed files with 73 additions and 36 deletions

View File

@@ -24,3 +24,10 @@ class EmailChange(BaseMessageType):
super(EmailChange, self).__init__(*args, **kwargs)
self.options['transactional'] = True
class RecoveryEmailCreate(BaseMessageType):
def __init__(self, *args, **kwargs):
super(RecoveryEmailCreate, self).__init__(*args, **kwargs)
self.options['transactional'] = True

View File

@@ -653,18 +653,15 @@ class SecondaryEmailChangeRequestTests(EventTestMixin, EmailTemplateTagMixin, Ca
self.do_secondary_email_change(self.user, new_email, registration_key)
self._assert_email(
subject=u'Request to change édX account secondary e-mail',
subject=u'Confirm your recovery email for édX',
body_fragments=[
u'We received a request to change the secondary e-mail associated with',
u'your édX account to {new_email}.'.format(
u'You\'ve registered this recovery email address for édX.'.format(
new_email=new_email,
),
u'If this is correct, please confirm your new secondary e-mail address by visiting:',
u'If you set this email address, click "confirm email."',
u'If you didn\'t request this change, you can disregard this email.',
u'http://edx.org/activate_secondary_email/{key}'.format(key=registration_key),
u'If you didn\'t request this, you don\'t need to do anything;',
u'you won\'t receive any more email from us.',
u'Please do not reply to this e-mail; if you require assistance,',
u'check the help section of the édX web site.',
],
)

View File

@@ -72,7 +72,7 @@ from student.helpers import (
cert_info,
generate_activation_email_context,
)
from student.message_types import EmailChange, PasswordReset
from student.message_types import EmailChange, PasswordReset, RecoveryEmailCreate
from student.models import (
AccountRecovery,
CourseEnrollment,
@@ -1034,7 +1034,6 @@ def do_email_change_request(user, new_email, activation_key=None, secondary_emai
message_context.update({
'old_email': user.email,
'new_email': new_email,
'is_secondary_email_change_request': secondary_email_change_request,
'confirm_link': '{protocol}://{site}{link}'.format(
protocol='https' if use_https else 'http',
site=configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME),
@@ -1042,11 +1041,18 @@ def do_email_change_request(user, new_email, activation_key=None, secondary_emai
),
})
msg = EmailChange().personalize(
recipient=Recipient(user.username, new_email),
language=preferences_api.get_user_preference(user, LANGUAGE_KEY),
user_context=message_context,
)
if secondary_email_change_request:
msg = RecoveryEmailCreate().personalize(
recipient=Recipient(user.username, new_email),
language=preferences_api.get_user_preference(user, LANGUAGE_KEY),
user_context=message_context,
)
else:
msg = EmailChange().personalize(
recipient=Recipient(user.username, new_email),
language=preferences_api.get_user_preference(user, LANGUAGE_KEY),
user_context=message_context,
)
try:
ace.send(msg)