Did a small fix where the server would crash if the user had no cookies.

This commit is contained in:
Bram van der Veen 2015-07-22 11:25:07 +02:00
parent abd175136a
commit e301ee0fca

View file

@ -59,7 +59,7 @@ function logout(req, res) {
} }
function is(req, res, next) { function is(req, res, next) {
var cookies = qs.parse(req.headers.cookie.replace(/\s/g, ''), ';', '='); var cookies = qs.parse((req.headers.cookie || '').replace(/\s/g, ''), ';', '=');
if (!cookies.username || !cookies.password) {next(); return;} if (!cookies.username || !cookies.password) {next(); return;}
var username = crypt.decrypt(cookies.username), var username = crypt.decrypt(cookies.username),