dont allow invalid status to be set

v1.18.x
barisusakli 11 years ago
parent bedadd8b5f
commit 4eabf41a21

@ -350,6 +350,11 @@ SocketUser.setStatus = function(socket, status, callback) {
if (!socket.uid) {
return callback(new Error('[[invalid-uid]]'));
}
var allowedStatus = ['online', 'offline', 'dnd', 'away'];
if (allowedStatus.indexOf(status) === -1) {
return callback(new Error('[[invalid-user-status]]'));
}
user.setUserField(socket.uid, 'status', status, function(err) {
if (err) {
return callback(err);

Loading…
Cancel
Save