Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions lib/chat-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,24 @@ function adminJoinGroup() {
}

function getCurrentUser(socket) {
var cookies = socket.handshake.headers['cookie'].split(';'),
userID;
if (socket.handshake.headers['cookie']) {
var cookies = socket.handshake.headers['cookie'].split(';'),
userID;

cookies.forEach(function(cookie) {
if (cookie.indexOf(conf.cookies.userID.key)) {
var userCookies = cookie.split('=');
cookies.forEach(function(cookie) {
if (cookie.indexOf(conf.cookies.userID.key)) {
var userCookies = cookie.split('=');

userID = userCookies.pop();
}
});
userID = userCookies.pop();
}
});

return userID;
} else {
var date = new Date();

return userID;
return 'user_' + date.getTime();
}
}

function assignGuestName(socket, userID) {
Expand Down
133 changes: 0 additions & 133 deletions test/public/js/chat-ui.js

This file was deleted.

14 changes: 0 additions & 14 deletions test/public/js/chat.js

This file was deleted.