From acccaeefeb3405c2726a43b84b24024674d17177 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 3 Feb 2013 18:53:34 -0500 Subject: [PATCH] fix case hole in onlineModeExceptions --- README.md | 2 ++ index.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 70c9adb..bb566f9 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,8 @@ Returns a `Server` instance and starts listening. This is a plain old JavaScript object. Add a key with the username you want to be exempt from online mode or offline mode (whatever mode the server is in). +Make sure the entries in this object are all lower case. + #### server.maxPlayers ### Not Immediately Obvious Data Type Formats diff --git a/index.js b/index.js index 9ef4088..9b003e9 100644 --- a/index.js +++ b/index.js @@ -103,7 +103,7 @@ function createServer(options) { function onHandshake(packet) { client.username = packet.username; - var isException = !!server.onlineModeExceptions[client.username]; + var isException = !!server.onlineModeExceptions[client.username.toLowerCase()]; var needToVerify = (onlineMode && ! isException) || (! onlineMode && isException); var serverId; if (needToVerify) { @@ -148,7 +148,7 @@ function createServer(options) { }); client.encryptionEnabled = true; - var isException = !!server.onlineModeExceptions[client.username]; + var isException = !!server.onlineModeExceptions[client.username.toLowerCase()]; var needToVerify = (onlineMode && ! isException) || (! onlineMode && isException); var nextStep = needToVerify ? verifyUsername : loginClient; nextStep();