diff --git a/lib/web/auth.js b/lib/web/auth.js index 98f03a10..937bbd91 100644 --- a/lib/web/auth.js +++ b/lib/web/auth.js @@ -44,6 +44,20 @@ function handleLogin(req, res) { httpOnly: true }); + res.cookie("auth", user.name + ":" + user.hash, { + domain: Config.get("http.domain"), + expires: new Date(Date.now() + 7*24*60*60*1000), + httpOnly: true + }); + + if (Config.get("https.enabled")) { + res.cookie("auth", user.name + ":" + user.hash, { + domain: Config.get("https.domain"), + expires: new Date(Date.now() + 7*24*60*60*1000), + httpOnly: true + }); + } + // Try to find an appropriate redirect var ref = req.header("referrer"); if (!ref) {