This commit is contained in:
calzoneman 2015-02-19 20:30:35 -06:00
parent 08a9eae2d3
commit df62ee8d58
9 changed files with 32 additions and 4 deletions

View file

@ -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 = {

View file

@ -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");

View file

@ -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;
}

View file

@ -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

View file

@ -69,3 +69,7 @@ footer {
.queue_entry.queue_active {
background-color: #d9edf7;
}
.navbar-inverse .navbar-text-nofloat {
color: #9d9d9d;
}

View file

@ -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;
}

View file

@ -63,3 +63,7 @@ footer {
.queue_entry.queue_active {
background-color: #d9edf7;
}
.navbar-inverse .navbar-text-nofloat {
color: #9d9d9d;
}

View file

@ -169,3 +169,7 @@ input.form-control[type="email"], textarea.form-control {
#newpollbtn {
margin-top: 10px;
}
.navbar-inverse .navbar-text-nofloat {
color: #c8c8c8;
}

View file

@ -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;
}