v1.18.x
barisusakli 10 years ago
parent e6b4a45cda
commit 2ea5f85d9b

@ -522,6 +522,8 @@ app.uid = null;
}); });
createHeaderTooltips(); createHeaderTooltips();
showEmailConfirmWarning();
ajaxify.variables.parse(); ajaxify.variables.parse();
ajaxify.currentPage = url; 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; showWelcomeMessage = window.location.href.indexOf('loggedin') !== -1;
exposeConfigToTemplates(); exposeConfigToTemplates();

@ -313,7 +313,7 @@ middleware.renderHeader = function(req, res, callback) {
}, },
user: function(next) { user: function(next) {
if (uid) { if (uid) {
user.getUserFields(uid, ['username', 'userslug', 'picture', 'status', 'banned'], next); user.getUserFields(uid, ['username', 'userslug', 'picture', 'status', 'email:confirmed', 'banned'], next);
} else { } else {
next(null, { next(null, {
username: '[[global:guest]]', username: '[[global:guest]]',
@ -336,6 +336,7 @@ middleware.renderHeader = function(req, res, callback) {
return; return;
} }
results.user.isAdmin = results.isAdmin || false; results.user.isAdmin = results.isAdmin || false;
results.user['email:confirmed'] = parseInt(results.user['email:confirmed'], 10) === 1;
templateValues.browserTitle = results.title; templateValues.browserTitle = results.title;
templateValues.isAdmin = results.user.isAdmin; templateValues.isAdmin = results.user.isAdmin;

Loading…
Cancel
Save