mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 10:35:55 +01:00
15
src/user.js
15
src/user.js
@@ -155,22 +155,29 @@ var bcrypt = require('bcryptjs'),
|
||||
},
|
||||
exists: function(next) {
|
||||
db.exists('user:' + uid, next);
|
||||
},
|
||||
isAdmin: function(next) {
|
||||
User.isAdministrator(uid, next);
|
||||
}
|
||||
}, function(err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if (!results.exists) {
|
||||
return callback(new Error('[[error:no-user]]'));
|
||||
}
|
||||
|
||||
if (results.isAdmin) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
var userData = results.userData;
|
||||
|
||||
if (parseInt(userData.banned, 10) === 1) {
|
||||
return callback(new Error('[[error:user-banned]]'));
|
||||
}
|
||||
|
||||
if (!results.exists) {
|
||||
return callback(new Error('[[error:no-user]]'));
|
||||
}
|
||||
|
||||
if (userData.email && parseInt(meta.config.requireEmailConfirmation, 10) === 1 && parseInt(userData['email:confirmed'], 10) !== 1) {
|
||||
return callback(new Error('[[error:email-not-confirmed]]'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user