Did a small fix where the server would crash if the user had no cookies.
This commit is contained in:
parent
abd175136a
commit
e301ee0fca
2
auth.js
2
auth.js
|
@ -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),
|
||||||
|
|
Loading…
Reference in a new issue