feat: show instructional modal after email change request

v1.18.x
Julian Lam 4 years ago
parent e95df2f066
commit 0e05cbe1f7

@ -3,8 +3,8 @@
define('forum/account/profile', [
'forum/account/header',
'components',
], function (header) {
'bootbox',
], function (header, bootbox) {
var Account = {};
Account.init = function () {
@ -14,6 +14,10 @@ define('forum/account/profile', [
processPage();
if (parseInt(ajaxify.data.emailChanged, 10) === 1) {
bootbox.alert('[[user:emailUpdate.change-instructions]]');
}
socket.removeListener('event:user_status_change', onUserStatusChange);
socket.on('event:user_status_change', onUserStatusChange);
};

@ -50,6 +50,10 @@ profileController.get = async function (req, res, next) {
userData.title = userData.username;
userData.allowCoverPicture = !userData.isSelf || !!meta.config['reputation:disabled'] || userData.reputation >= meta.config['min:rep:cover-picture'];
// Show email changed modal on first access after said change
userData.emailChanged = req.session.emailChanged;
delete req.session.emailChanged;
if (!userData.profileviews) {
userData.profileviews = 1;
}

@ -52,6 +52,7 @@ Interstitials.email = async (data) => {
email: formData.email,
force: true,
});
data.req.session.emailChanged = 1;
} else {
// User attempting to edit another user's email -- not allowed
throw new Error('[[error:no-privileges]]');

Loading…
Cancel
Save