dont let joining other uid rooms

This commit is contained in:
barisusakli
2015-05-14 13:53:02 -04:00
parent 36853f4ad8
commit 10de7a92e4
2 changed files with 12 additions and 3 deletions

View File

@@ -54,10 +54,15 @@ SocketMeta.rooms.enter = function(socket, data, callback) {
if (!socket.uid) {
return;
}
if (!data) {
return callback(new Error('[[error:invalid-data]]'));
}
if (data.enter && data.enter.startsWith('uid_') && data.enter !== 'uid_' + socket.uid) {
return callback(new Error('[[error:not-allowed]]'));
}
if (socket.currentRoom) {
rooms.leave(socket, socket.currentRoom);
if (socket.currentRoom.indexOf('topic') !== -1) {