Skip to content

Node.js based forum software built for the modern web

closes #2560

Barış Soner Uşaklı1d5e15eab401
diff --git a/public/language/en_GB/error.json b/public/language/en_GB/error.json
index 812ae03a17..b2f9a3b86b 100644
--- a/public/language/en_GB/error.json
+++ b/public/language/en_GB/error.json
@@ -24,6 +24,7 @@
"email-taken": "Email taken",
"email-not-confirmed": "Your email has not been confirmed yet, please click here to confirm your email.",
"email-not-confirmed-chat": "You are unable to chat until your email is confirmed",
+ "no-email-to-confirm": "This forum requires email confirmation, please click here to enter an email",
"username-too-short": "Username too short",
"username-too-long": "Username too long",
diff --git a/public/src/app.js b/public/src/app.js
index b4a091f960..d3a47a1bc6 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -570,7 +570,21 @@ app.cacheBuster = null;
};
function showEmailConfirmWarning() {
- if (config.requireEmailConfirmation && app.user.uid && !app.user['email:confirmed']) {
+ if (!config.requireEmailConfirmation || !app.user.uid) {
+ return;
+ }
+ if (!app.user.email) {
+ app.alert({
+ alert_id: 'email_confirm',
+ message: '[[error:no-email-to-confirm]]',
+ type: 'warning',
+ timeout: 0,
+ clickfn: function() {
+ app.removeAlert('email_confirm');
+ ajaxify.go('user/' + app.user.userslug + '/edit');
+ }
+ });
+ } else if (!app.user['email:confirmed']) {
app.alert({
alert_id: 'email_confirm',
message: '[[error:email-not-confirmed]]',
diff --git a/src/middleware/middleware.js b/src/middleware/middleware.js
index 43e2a2ea86..658b9e0c63 100644
--- a/src/middleware/middleware.js
+++ b/src/middleware/middleware.js
@@ -317,7 +317,7 @@ middleware.renderHeader = function(req, res, callback) {
},
user: function(next) {
if (uid) {
- user.getUserFields(uid, ['username', 'userslug', 'picture', 'status', 'email:confirmed', 'banned'], next);
+ user.getUserFields(uid, ['username', 'userslug', 'email', 'picture', 'status', 'email:confirmed', 'banned'], next);
} else {
next(null, {
username: '[[global:guest]]',
@@ -342,7 +342,7 @@ middleware.renderHeader = function(req, res, callback) {
results.user.isAdmin = results.isAdmin || false;
results.user.uid = parseInt(results.user.uid, 10);
results.user['email:confirmed'] = parseInt(results.user['email:confirmed'], 10) === 1;
-
+
templateValues.browserTitle = results.title;
templateValues.isAdmin = results.user.isAdmin;
templateValues.user = results.user;