From 2e964ca6294568ff0bb90d56fd0c978fd17f9eb0 Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Wed, 8 Oct 2014 22:16:10 +0200 Subject: [PATCH] Prevent multiple logins --- client/js/shout.js | 26 +++++++++++++------------- src/server.js | 4 +--- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/client/js/shout.js b/client/js/shout.js index 3e79e67d..fa906eaa 100644 --- a/client/js/shout.js +++ b/client/js/shout.js @@ -87,23 +87,23 @@ $(function() { error.hide(); }); } - body.addClass("signed-out"); + if (!token) { + body.addClass("signed-out"); + } var input = login.find("input[name='user']"); if (input.val() === "") { input.val($.cookie("user") || ""); } - setTimeout(function() { - if (!body.hasClass("signed-out")) { - return; - } - sidebar.find(".sign-in") - .click() - .end() - .find(".networks") - .html("") - .next() - .show(); - }, token ? 200 : 0); + if (token) { + return; + } + sidebar.find(".sign-in") + .click() + .end() + .find(".networks") + .html("") + .next() + .show(); }); socket.on("init", function(data) { diff --git a/src/server.js b/src/server.js index 59780cfd..1292a21c 100644 --- a/src/server.js +++ b/src/server.js @@ -152,9 +152,7 @@ function auth(data) { } }); if (!success) { - if (!data.token) { - socket.emit("auth"); - } + socket.emit("auth"); } } }