mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 10:46:14 +01:00
fix email update on mongo
This commit is contained in:
@@ -17,6 +17,10 @@ module.exports = function(db, module) {
|
||||
};
|
||||
|
||||
module.setObjectField = function(key, field, value, callback) {
|
||||
callback = callback || helpers.noop;
|
||||
if (!field) {
|
||||
return callback();
|
||||
}
|
||||
var data = {};
|
||||
field = helpers.fieldToString(field);
|
||||
data[field] = value;
|
||||
@@ -172,7 +176,7 @@ module.exports = function(db, module) {
|
||||
|
||||
module.deleteObjectField = function(key, field, callback) {
|
||||
callback = callback || helpers.noop;
|
||||
if (!key) {
|
||||
if (!key || !field) {
|
||||
return callback();
|
||||
}
|
||||
var data = {};
|
||||
|
||||
@@ -148,7 +148,7 @@ module.exports = function(User) {
|
||||
User.setUserField(uid, 'email', newEmail, next);
|
||||
},
|
||||
function(next) {
|
||||
if (parseInt(meta.config.requireEmailConfirmation, 10) === 1) {
|
||||
if (parseInt(meta.config.requireEmailConfirmation, 10) === 1 && newEmail) {
|
||||
User.email.verify(uid, newEmail);
|
||||
}
|
||||
User.setUserField(uid, 'email:confirmed', 0, next);
|
||||
|
||||
Reference in New Issue
Block a user