From 01bfb946ccebc9a649cfe9d9034f07683e9cc576 Mon Sep 17 00:00:00 2001 From: MrXyfir Date: Tue, 5 Mar 2019 12:55:44 -0800 Subject: [PATCH] Make cookie persistent --- server/api/login/login.ts | 2 +- server/api/login/passwordless/finish.ts | 2 +- server/api/register/finish.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/api/login/login.ts b/server/api/login/login.ts index 0a9b604..a330236 100644 --- a/server/api/login/login.ts +++ b/server/api/login/login.ts @@ -10,7 +10,7 @@ export function api_login( ): void { login(req.body.email, req.body.pass, req.body.otp) .then(token => { - res.cookie(JWT_COOKIE_NAME, token); + res.cookie(JWT_COOKIE_NAME, token, { maxAge: 31540000000 }); res.status(200).json({}); }) .catch(next); diff --git a/server/api/login/passwordless/finish.ts b/server/api/login/passwordless/finish.ts index bcfb9ab..2f64007 100644 --- a/server/api/login/passwordless/finish.ts +++ b/server/api/login/passwordless/finish.ts @@ -11,7 +11,7 @@ export function api_finishPasswordlessLogin( req.redirect = true; finishPasswordlessLogin(req.jwt) .then(token => { - res.cookie(JWT_COOKIE_NAME, token); + res.cookie(JWT_COOKIE_NAME, token, { maxAge: 31540000000 }); res.redirect(ACCOWNT_WEB_URL); }) .catch(next); diff --git a/server/api/register/finish.ts b/server/api/register/finish.ts index 2491260..04f8cda 100644 --- a/server/api/register/finish.ts +++ b/server/api/register/finish.ts @@ -11,7 +11,7 @@ export function api_finishRegistration( req.redirect = true; finishRegistration(req.jwt) .then(token => { - res.cookie(JWT_COOKIE_NAME, token); + res.cookie(JWT_COOKIE_NAME, token, { maxAge: 31540000000 }); res.redirect(ACCOWNT_WEB_URL); }) .catch(next);