closes #1592, closes #1634

v1.18.x
barisusakli 11 years ago
parent d7eb89336d
commit b537666e5c

@ -66,5 +66,9 @@
{
"field": "chatMessagesToDisplay",
"value": 50
},
{
"field": "requireEmailConfirmation",
"value": 1
}
]

@ -19,6 +19,7 @@
"username-taken": "Username taken",
"email-taken": "Email taken",
"email-not-confirmed": "Your email is not confirmed",
"username-too-short": "User name too short",

@ -16,6 +16,11 @@
"upvoted_your_post": "<strong>%1</strong> has upvoted your post.",
"favourited_your_post": "<strong>%1</strong> has favourited your post.",
"user_flagged_post": "<strong>%1</strong> flagged a post.",
"user_posted_to" : "<strong>%1</strong> has posted a reply to: <strong>%2</strong>"
"user_posted_to" : "<strong>%1</strong> has posted a reply to: <strong>%2</strong>",
"email-confirmed": "Email Confirmed",
"email-confirmed-message": "Thank you for validating your email. Your account is now fully activated.",
"email-confirm-error": "An error occurred...",
"email-confirm-error-message": "There was a problem validating your email address. Perhaps the code was invalid or has expired."
}

@ -210,20 +210,7 @@ Controllers.register = function(req, res, next) {
Controllers.confirmEmail = function(req, res, next) {
user.email.confirm(req.params.code, function (data) {
if (data.status === 'ok') {
data = {
'alert-class': 'alert-success',
title: 'Email Confirmed',
text: 'Thank you for vaidating your email. Your account is now fully activated.'
};
} else {
data = {
'alert-class': 'alert-danger',
title: 'An error occurred...',
text: 'There was a problem validating your email address. Perhaps the code was invalid or has expired.'
};
}
data.status = data.status === 'ok';
res.render('confirm', data);
});
};

@ -25,12 +25,12 @@ var groups = require('../groups'),
settings: {}
};
SocketAdmin.before = function(socket, next) {
SocketAdmin.before = function(socket, method, next) {
user.isAdministrator(socket.uid, function(err, isAdmin) {
if (!err && isAdmin) {
next();
} else {
winston.warn('[socket.io] Call to admin method blocked (accessed by uid ' + socket.uid + ')');
winston.warn('[socket.io] Call to admin method ( ' + method + ' ) blocked (accessed by uid ' + socket.uid + ')');
}
});
};

@ -165,7 +165,7 @@ Sockets.init = function(server) {
}
if (Namespaces[namespace].before) {
Namespaces[namespace].before(socket, function() {
Namespaces[namespace].before(socket, payload.name, function() {
callMethod(methodToCall);
});
} else {

@ -155,21 +155,20 @@ var bcrypt = require('bcryptjs'),
User.isReadyToPost = function(uid, callback) {
async.parallel({
banned: function(next) {
User.getUserField(uid, 'banned', next);
userData: function(next) {
User.getUserFields(uid, ['banned', 'lastposttime', 'email', 'email:confirmed'], next);
},
exists: function(next) {
db.exists('user:' + uid, next);
},
lastposttime: function(next) {
User.getUserField(uid, 'lastposttime', next);
}
}, function(err, results) {
if (err) {
return callback(err);
}
if (parseInt(results.banned, 10) === 1) {
var userData = results.userData;
if (parseInt(userData.banned, 10) === 1) {
return callback(new Error('[[error:user-banned]]'));
}
@ -177,7 +176,11 @@ var bcrypt = require('bcryptjs'),
return callback(new Error('[[error:no-user]]'));
}
var lastposttime = results.lastposttime;
if (userData.email && (parseInt(meta.config.requireEmailConfirmation, 10) === 1 || meta.config.requireEmailConfirmation === undefined) && parseInt(userData['email:confirmed'], 10) !== 1) {
return callback(new Error('[[error:email-not-confirmed]]'));
}
var lastposttime = userData.lastposttime;
if (!lastposttime) {
lastposttime = 0;
}

@ -137,7 +137,7 @@ module.exports = function(User) {
if (userData.email !== undefined) {
db.setObjectField('email:uid', userData.email, uid);
if (parseInt(uid, 10) !== 1) {
if (parseInt(uid, 10) !== 1 && (parseInt(meta.config.requireEmailConfirmation, 10) === 1 || meta.config.requireEmailConfirmation === undefined)) {
User.email.verify(uid, userData.email);
}
}

@ -45,7 +45,6 @@ var async = require('async'),
db.expireAt('confirm:' + confirm_code, Math.floor(Date.now() / 1000 + 60 * 60 * 2), next);
}
], function(err) {
// Send intro email w/ confirm code
user.getUserField(uid, 'username', function(err, username) {
if (err) {
return winston.error(err.message);
@ -73,7 +72,7 @@ var async = require('async'),
}
if (confirmObj && confirmObj.uid && confirmObj.email) {
db.setObjectField('email:confirmed', confirmObj.email, '1', function() {
user.setUserField(confirmObj.uid, 'email:confirmed', 1, function() {
callback({
status: 'ok'
});

Loading…
Cancel
Save