This commit is contained in:
barisusakli
2016-08-11 08:41:34 +03:00
parent d7cda83c8e
commit 1d70dc0d8b
2 changed files with 22 additions and 11 deletions

View File

@@ -58,14 +58,15 @@ module.exports = function(User) {
if (fields.indexOf('banned') !== -1) {
// Also retrieve ban expiry for these users
db.sortedSetScores('users:banned:expire', uids, function(err, scores) {
users = users.map(function(userObj, idx) {
users.forEach(function(userObj, idx) {
userObj.banned_until = scores[idx] || 0;
userObj.banned_until_readable = scores[idx] ? new Date(scores[idx]).toString() : 'Not Banned';
});
modifyUserData(users, fieldsToRemove, callback);
});
} else {
modifyUserData(users, fieldsToRemove, callback);
}
modifyUserData(users, fieldsToRemove, callback);
});
};
@@ -104,7 +105,9 @@ module.exports = function(User) {
return;
}
user.username = validator.escape(user.username ? user.username.toString() : '');
if (user.hasOwnProperty('username')) {
user.username = validator.escape(user.username ? user.username.toString() : '');
}
if (user.password) {
user.password = undefined;