diff --git a/lib/io/ioserver.js b/lib/io/ioserver.js index 6f669d52..49cd369f 100644 --- a/lib/io/ioserver.js +++ b/lib/io/ioserver.js @@ -34,6 +34,10 @@ function handleAuth(socket, accept) { if (data.headers.cookie) { cookieParser(data, null, function () { var auth = data.signedCookies.auth; + if (!auth) { + return accept(null, true); + } + session.verifySession(auth, function (err, user) { if (!err) { socket.user = { diff --git a/lib/session.js b/lib/session.js index 59b27452..72c03915 100644 --- a/lib/session.js +++ b/lib/session.js @@ -21,6 +21,10 @@ exports.genSession = function (account, expiration, cb) { }; exports.verifySession = function (input, cb) { + if (typeof input !== "string") { + return cb("Invalid auth string"); + } + var parts = input.split(":"); if (parts.length !== 4) { return cb("Invalid auth string"); diff --git a/lib/web/auth.js b/lib/web/auth.js index e1116cf2..8154d104 100644 --- a/lib/web/auth.js +++ b/lib/web/auth.js @@ -27,7 +27,7 @@ function handleLogin(req, res) { dest = dest.match(/login|logout/) ? null : dest; if (typeof name !== "string" || typeof password !== "string") { - res.send(400); + res.sendStatus(400); return; } @@ -35,7 +35,7 @@ function handleLogin(req, res) { if (host.indexOf(Config.get("http.root-domain")) === -1 && Config.get("http.alt-domains").indexOf(host) === -1) { Logger.syslog.log("WARNING: Attempted login from non-approved domain " + host); - return res.send(403); + return res.sendStatus(403); } var expiration; @@ -166,7 +166,7 @@ function handleRegister(req, res) { var ip = webserver.ipForRequest(req); if (typeof name !== "string" || typeof password !== "string") { - res.send(400); + res.sendStatus(400); return; } diff --git a/templates/nav.jade b/templates/nav.jade index 2fa0281a..8791f091 100644 --- a/templates/nav.jade +++ b/templates/nav.jade @@ -56,7 +56,7 @@ mixin navloginform(redirect) .checkbox label input(type="checkbox", name="remember") - | Remember me + span.navbar-text-nofloat Remember me button#login.btn.btn-default(type="submit") Login .visible-md p#loginform.navbar-text.pull-right diff --git a/www/css/themes/bootstrap-theme.min.css b/www/css/themes/bootstrap-theme.min.css index 8685531d..ae9fae66 100644 --- a/www/css/themes/bootstrap-theme.min.css +++ b/www/css/themes/bootstrap-theme.min.css @@ -69,3 +69,7 @@ footer { .queue_entry.queue_active { background-color: #d9edf7; } + +.navbar-inverse .navbar-text-nofloat { + color: #9d9d9d; +} diff --git a/www/css/themes/cyborg.css b/www/css/themes/cyborg.css index 965b74b5..d180e636 100644 --- a/www/css/themes/cyborg.css +++ b/www/css/themes/cyborg.css @@ -81,3 +81,7 @@ input.form-control[type="email"], textarea.form-control { .queue_entry.queue_active { background-color: #333333; } + +.navbar-inverse .navbar-text-nofloat { + color: #888; +} diff --git a/www/css/themes/light.css b/www/css/themes/light.css index 478af6bd..4c72fa74 100644 --- a/www/css/themes/light.css +++ b/www/css/themes/light.css @@ -63,3 +63,7 @@ footer { .queue_entry.queue_active { background-color: #d9edf7; } + +.navbar-inverse .navbar-text-nofloat { + color: #9d9d9d; +} diff --git a/www/css/themes/modern.css b/www/css/themes/modern.css index b4e66487..3e79edd0 100644 --- a/www/css/themes/modern.css +++ b/www/css/themes/modern.css @@ -169,3 +169,7 @@ input.form-control[type="email"], textarea.form-control { #newpollbtn { margin-top: 10px; } + +.navbar-inverse .navbar-text-nofloat { + color: #c8c8c8; +} diff --git a/www/css/themes/slate.css b/www/css/themes/slate.css index 0259f5e7..0c46cda1 100644 --- a/www/css/themes/slate.css +++ b/www/css/themes/slate.css @@ -93,3 +93,7 @@ input.form-control[type="email"], textarea.form-control { border-color: #aaaaaa; background-color: #272b30; } + +.navbar-inverse .navbar-text-nofloat { + color: #ccc; +}