Add recovery email to account settings page
This commit is contained in:
@@ -3034,6 +3034,7 @@ ACCOUNT_VISIBILITY_CONFIGURATION = {
|
||||
"account_privacy",
|
||||
"accomplishments_shared",
|
||||
"extended_profile",
|
||||
"secondary_email",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
profile_image: null,
|
||||
accomplishments_shared: false,
|
||||
default_public_account_fields: [],
|
||||
extended_profile: []
|
||||
extended_profile: [],
|
||||
secondary_email: ''
|
||||
},
|
||||
|
||||
parse: function(response) {
|
||||
|
||||
@@ -27,14 +27,16 @@
|
||||
enterpriseReadonlyAccountFields,
|
||||
edxSupportUrl,
|
||||
extendedProfileFields,
|
||||
displayAccountDeletion
|
||||
displayAccountDeletion,
|
||||
isSecondaryEmailFeatureEnabled
|
||||
) {
|
||||
var $accountSettingsElement, userAccountModel, userPreferencesModel, aboutSectionsData,
|
||||
accountsSectionData, ordersSectionData, accountSettingsView, showAccountSettingsPage,
|
||||
showLoadingError, orderNumber, getUserField, userFields, timeZoneDropdownField, countryDropdownField,
|
||||
emailFieldView, socialFields, accountDeletionFields, platformData,
|
||||
emailFieldView, secondaryEmailFieldView, socialFields, accountDeletionFields, platformData,
|
||||
aboutSectionMessageType, aboutSectionMessage, fullnameFieldView, countryFieldView,
|
||||
fullNameFieldData, emailFieldData, countryFieldData, additionalFields, fieldItem;
|
||||
fullNameFieldData, emailFieldData, secondaryEmailFieldData, countryFieldData, additionalFields,
|
||||
fieldItem, emailFieldViewIndex;
|
||||
|
||||
$accountSettingsElement = $('.wrapper-account-settings');
|
||||
|
||||
@@ -82,6 +84,14 @@
|
||||
};
|
||||
}
|
||||
|
||||
secondaryEmailFieldData = {
|
||||
model: userAccountModel,
|
||||
title: gettext('Secondary Email Address'),
|
||||
valueAttribute: 'secondary_email',
|
||||
helpMessage: gettext('You may access your account when single-sign on is not available.'),
|
||||
persistChanges: true
|
||||
};
|
||||
|
||||
fullNameFieldData = {
|
||||
model: userAccountModel,
|
||||
title: gettext('Full Name'),
|
||||
@@ -233,6 +243,19 @@
|
||||
}
|
||||
];
|
||||
|
||||
// Secondary email address
|
||||
if (isSecondaryEmailFeatureEnabled) {
|
||||
secondaryEmailFieldView = {
|
||||
view: new AccountSettingsFieldViews.EmailFieldView(secondaryEmailFieldData)
|
||||
};
|
||||
emailFieldViewIndex = aboutSectionsData[0].fields.indexOf(emailFieldView);
|
||||
|
||||
// Insert secondary email address after email address field.
|
||||
aboutSectionsData[0].fields.splice(
|
||||
emailFieldViewIndex + 1, 0, secondaryEmailFieldView
|
||||
)
|
||||
}
|
||||
|
||||
// Add the extended profile fields
|
||||
additionalFields = aboutSectionsData[1];
|
||||
for (var field in extendedProfileFields) { // eslint-disable-line guard-for-in, no-restricted-syntax, vars-on-top, max-len
|
||||
|
||||
@@ -10,6 +10,7 @@ from django.utils.translation import ugettext as _
|
||||
from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_string
|
||||
from openedx.core.djangolib.markup import HTML
|
||||
from webpack_loader.templatetags.webpack_loader import render_bundle
|
||||
from openedx.core.djangoapps.user_api.accounts.utils import is_secondary_email_feature_enabled_for_user
|
||||
%>
|
||||
|
||||
<%inherit file="/main.html" />
|
||||
@@ -46,6 +47,7 @@ from webpack_loader.templatetags.webpack_loader import render_bundle
|
||||
edxSupportUrl = '${ edx_support_url | n, js_escaped_string }',
|
||||
extendedProfileFields = ${ extended_profile_fields | n, dump_js_escaped_json },
|
||||
displayAccountDeletion = ${ enable_account_deletion | n, dump_js_escaped_json};
|
||||
isSecondaryEmailFeatureEnabled = ${ bool(is_secondary_email_feature_enabled_for_user(user)) | n, dump_js_escaped_json },
|
||||
|
||||
AccountSettingsFactory(
|
||||
fieldsData,
|
||||
@@ -65,7 +67,8 @@ from webpack_loader.templatetags.webpack_loader import render_bundle
|
||||
enterpriseReadonlyAccountFields,
|
||||
edxSupportUrl,
|
||||
extendedProfileFields,
|
||||
displayAccountDeletion
|
||||
displayAccountDeletion,
|
||||
isSecondaryEmailFeatureEnabled
|
||||
);
|
||||
</%static:require_module>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user