|
@@ -115,12 +115,12 @@ io.on('connection', (socket) => {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- if (admins && admins[username]) {
|
|
|
|
|
|
+ if (admins && admins[username] && admins[username].password) {
|
|
if (!password) {
|
|
if (!password) {
|
|
log('- Attempted login as admin without password.', username, '(' + ip + ')');
|
|
log('- Attempted login as admin without password.', username, '(' + ip + ')');
|
|
socket.emit('passwordRequired');
|
|
socket.emit('passwordRequired');
|
|
return;
|
|
return;
|
|
- } else if (admins[username] != password) {
|
|
|
|
|
|
+ } else if (admins[username].password != password) {
|
|
log('- Attempted login as admin with wrong password.', username, '(' + ip + ')');
|
|
log('- Attempted login as admin with wrong password.', username, '(' + ip + ')');
|
|
socket.emit('passwordWrong');
|
|
socket.emit('passwordWrong');
|
|
return;
|
|
return;
|
|
@@ -128,6 +128,9 @@ io.on('connection', (socket) => {
|
|
|
|
|
|
log('- Admin "' + username + '" login successful');
|
|
log('- Admin "' + username + '" login successful');
|
|
user.admin = true;
|
|
user.admin = true;
|
|
|
|
+ if (admins[username].color) {
|
|
|
|
+ user.color = admins[username].color;
|
|
|
|
+ }
|
|
|
|
|
|
socket.on('requestKick', (userToBeKicked) => {
|
|
socket.on('requestKick', (userToBeKicked) => {
|
|
log('- Admin "' + username + '" requested kick of User "' + userToBeKicked.name + '"');
|
|
log('- Admin "' + username + '" requested kick of User "' + userToBeKicked.name + '"');
|
|
@@ -143,7 +146,9 @@ io.on('connection', (socket) => {
|
|
log('- New user logged in:', username, '(' + ip + ')');
|
|
log('- New user logged in:', username, '(' + ip + ')');
|
|
|
|
|
|
user.name = username;
|
|
user.name = username;
|
|
- user.color = getRandomColor(username);
|
|
|
|
|
|
+ if (!user.color) {
|
|
|
|
+ user.color = getRandomColor(username);
|
|
|
|
+ }
|
|
|
|
|
|
socket.emit('serverLogin', getCleanUser(user), history);
|
|
socket.emit('serverLogin', getCleanUser(user), history);
|
|
io.emit('userJoined', username);
|
|
io.emit('userJoined', username);
|