From 3552b73679cecd42c71bf77909f6548152e21ee1 Mon Sep 17 00:00:00 2001 From: MinusGix Date: Tue, 4 Aug 2020 19:27:35 -0400 Subject: [PATCH] Update client.js --- client/client.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/client.js b/client/client.js index 8c8a9af..1238e56 100644 --- a/client/client.js +++ b/client/client.js @@ -316,6 +316,7 @@ function join(channel) { var wasConnected = false; ws.onopen = function () { + var shouldConnect = true; if (!wasConnected) { if (location.hash) { myNick = location.hash.substr(1); @@ -323,11 +324,14 @@ function join(channel) { var newNick = prompt('Nickname:', myNick); if (newNick !== null) { myNick = newNick; + } else { + // The user cancelled the prompt in some manner + shouldConnect = false; } } } - if (myNick) { + if (myNick && shouldConnect) { localStorageSet('my-nick', myNick); send({ cmd: 'join', channel: channel, nick: myNick }); }