diff options
| author | Adam Soltys <[email protected]> | 2020-08-18 23:42:27 -0400 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-08-18 23:42:27 -0400 |
| commit | 81e8db888bbf51cfc578588ec05bf5963e7ab379 (patch) | |
| tree | 919ddd26b1fa93cf632bc10b5738bbb8881a4d2a /lib/sockets.js | |
| parent | 5d2b15eef79c9c198719be50caa0aa2b35461431 (diff) | |
| download | coinos-server-81e8db888bbf51cfc578588ec05bf5963e7ab379.tar.gz coinos-server-81e8db888bbf51cfc578588ec05bf5963e7ab379.zip | |
quietly close unauthorized sockets
Diffstat (limited to 'lib/sockets.js')
| -rw-r--r-- | lib/sockets.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/sockets.js b/lib/sockets.js index ab16e2fa..e1896b8f 100644 --- a/lib/sockets.js +++ b/lib/sockets.js @@ -86,8 +86,7 @@ wss.on("connection", function (ws, req) { case "login": let token = data; try { - if (!token || token === "null") - throw new Error("Unauthorized socket login"); + if (!token || token === "null") return ws.close(); const username = jwt.decode(token).username; if (!username) throw new Error("Invalid JWT token"); |
