From 4c1c05e4da2f1ed66bf290df0ec597fa6d4b024a Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Wed, 11 Jan 2017 22:48:04 -0700 Subject: [PATCH] Fix bug with already logged in/connected check logic @ login --- core/user_login.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/user_login.js b/core/user_login.js index 84d20a9d..76b01598 100644 --- a/core/user_login.js +++ b/core/user_login.js @@ -29,7 +29,7 @@ function userLogin(client, username, password, cb) { // Loop through active connections -- which includes the current -- // and check for matching user ID. If the count is > 1, disallow. // - let existingClientConnection = + let existingClientConnection; clientConnections.forEach(function connEntry(cc) { if(cc.user !== user && cc.user.userId === user.userId) { existingClientConnection = cc; @@ -47,7 +47,9 @@ function userLogin(client, username, password, cb) { var existingConnError = new Error('Already logged in as supplied user'); existingConnError.existingConn = true; - return cb(existingClientConnection); + // :TODO: We should use EnigError & pass existing connection as second param + + return cb(existingConnError); }