Skip to content

Commit

Permalink
feat: show instructional modal after email change request
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Jul 30, 2021
1 parent e95df2f commit 0e05cbe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions public/src/client/account/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

define('forum/account/profile', [
'forum/account/header',
'components',
], function (header) {
'bootbox',
], function (header, bootbox) {
var Account = {};

Account.init = function () {
Expand All @@ -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);
};
Expand Down
4 changes: 4 additions & 0 deletions src/controllers/accounts/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/user/interstitials.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]]');
Expand Down

0 comments on commit 0e05cbe

Please sign in to comment.