1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-08-07 14:35:26 +02:00

Set auth cookie lifetime

This commit is contained in:
Taly 2020-07-27 17:13:17 +03:00 committed by GitHub
parent 40d5285e5e
commit e0aeeba117
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -51,7 +51,10 @@ router.post('/auth', parseForm, csrfProtection, async (req, res) => {
iat: Date.now(),
}, passHash + config.secret);
res.cookie('authToken', token, { httpOnly: true });
res.cookie('authToken', token, {
httpOnly: true,
expires: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000) // 1 year
});
res.redirect('/');
});