From e301ee0fcaf77e010be7a4b8616ebda6375181f1 Mon Sep 17 00:00:00 2001 From: Bram van der Veen <96aa48@gmail.com> Date: Wed, 22 Jul 2015 11:25:07 +0200 Subject: [PATCH] Did a small fix where the server would crash if the user had no cookies. --- auth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth.js b/auth.js index fab465d..00fcd67 100644 --- a/auth.js +++ b/auth.js @@ -59,7 +59,7 @@ function logout(req, res) { } 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;} var username = crypt.decrypt(cookies.username),