mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
dont let joining other uid rooms
This commit is contained in:
@@ -169,7 +169,8 @@ app.cacheBuster = null;
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
app.enterRoom = function (room) {
|
app.enterRoom = function (room, callback) {
|
||||||
|
callback = callback || function() {};
|
||||||
if (socket) {
|
if (socket) {
|
||||||
if (app.currentRoom === room) {
|
if (app.currentRoom === room) {
|
||||||
return;
|
return;
|
||||||
@@ -180,9 +181,12 @@ app.cacheBuster = null;
|
|||||||
username: app.user.username,
|
username: app.user.username,
|
||||||
userslug: app.user.userslug,
|
userslug: app.user.userslug,
|
||||||
picture: app.user.picture
|
picture: app.user.picture
|
||||||
|
}, function(err) {
|
||||||
|
if (err) {
|
||||||
|
app.alertError(err.message);
|
||||||
|
}
|
||||||
|
app.currentRoom = room;
|
||||||
});
|
});
|
||||||
|
|
||||||
app.currentRoom = room;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -54,10 +54,15 @@ SocketMeta.rooms.enter = function(socket, data, callback) {
|
|||||||
if (!socket.uid) {
|
if (!socket.uid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return callback(new Error('[[error:invalid-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) {
|
if (socket.currentRoom) {
|
||||||
rooms.leave(socket, socket.currentRoom);
|
rooms.leave(socket, socket.currentRoom);
|
||||||
if (socket.currentRoom.indexOf('topic') !== -1) {
|
if (socket.currentRoom.indexOf('topic') !== -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user