mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
closes #2481
This commit is contained in:
@@ -522,6 +522,8 @@ app.uid = null;
|
||||
});
|
||||
|
||||
createHeaderTooltips();
|
||||
showEmailConfirmWarning();
|
||||
|
||||
ajaxify.variables.parse();
|
||||
ajaxify.currentPage = url;
|
||||
|
||||
@@ -572,6 +574,26 @@ app.uid = null;
|
||||
});
|
||||
};
|
||||
|
||||
function showEmailConfirmWarning() {
|
||||
if (config.requireEmailConfirmation && app.user.uid && !app.user['email:confirmed']) {
|
||||
app.alert({
|
||||
alert_id: 'email_confirm',
|
||||
message: '[[error:email-not-confirmed]]',
|
||||
type: 'warning',
|
||||
timeout: 0,
|
||||
clickfn: function() {
|
||||
app.removeAlert('email_confirm');
|
||||
socket.emit('user.emailConfirm', {}, function(err) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
app.alertSuccess('[[notifications:email-confirm-sent]]');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
showWelcomeMessage = window.location.href.indexOf('loggedin') !== -1;
|
||||
|
||||
exposeConfigToTemplates();
|
||||
|
||||
@@ -313,7 +313,7 @@ middleware.renderHeader = function(req, res, callback) {
|
||||
},
|
||||
user: function(next) {
|
||||
if (uid) {
|
||||
user.getUserFields(uid, ['username', 'userslug', 'picture', 'status', 'banned'], next);
|
||||
user.getUserFields(uid, ['username', 'userslug', 'picture', 'status', 'email:confirmed', 'banned'], next);
|
||||
} else {
|
||||
next(null, {
|
||||
username: '[[global:guest]]',
|
||||
@@ -336,6 +336,7 @@ middleware.renderHeader = function(req, res, callback) {
|
||||
return;
|
||||
}
|
||||
results.user.isAdmin = results.isAdmin || false;
|
||||
results.user['email:confirmed'] = parseInt(results.user['email:confirmed'], 10) === 1;
|
||||
|
||||
templateValues.browserTitle = results.title;
|
||||
templateValues.isAdmin = results.user.isAdmin;
|
||||
|
||||
Reference in New Issue
Block a user