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