diff --git a/src/components/AuthenticationFlow/EmailLoginForm.tsx b/src/components/AuthenticationFlow/EmailLoginForm.tsx index 49b4e46a4..428ebf04e 100644 --- a/src/components/AuthenticationFlow/EmailLoginForm.tsx +++ b/src/components/AuthenticationFlow/EmailLoginForm.tsx @@ -26,7 +26,10 @@ const EmailLoginForm: FunctionComponent<{}> = () => { // Log the user in and reload the page if (response?.token) { - Cookies.set(TOKEN_COOKIE_NAME, response.token); + Cookies.set(TOKEN_COOKIE_NAME, response.token, { + path: '/', + expires: 30, + }); window.location.reload(); return; diff --git a/src/components/AuthenticationFlow/GitHubButton.tsx b/src/components/AuthenticationFlow/GitHubButton.tsx index 79f2c935f..4f7825ae1 100644 --- a/src/components/AuthenticationFlow/GitHubButton.tsx +++ b/src/components/AuthenticationFlow/GitHubButton.tsx @@ -59,7 +59,10 @@ export function GitHubButton(props: GitHubButtonProps) { localStorage.removeItem(GITHUB_REDIRECT_AT); localStorage.removeItem(GITHUB_LAST_PAGE); - Cookies.set(TOKEN_COOKIE_NAME, response.token); + Cookies.set(TOKEN_COOKIE_NAME, response.token, { + path: '/', + expires: 30, + }); window.location.href = redirectUrl; }) .catch((err) => { diff --git a/src/components/AuthenticationFlow/GoogleButton.tsx b/src/components/AuthenticationFlow/GoogleButton.tsx index a06e531c2..bde439fd7 100644 --- a/src/components/AuthenticationFlow/GoogleButton.tsx +++ b/src/components/AuthenticationFlow/GoogleButton.tsx @@ -57,7 +57,10 @@ export function GoogleButton(props: GoogleButtonProps) { localStorage.removeItem(GOOGLE_REDIRECT_AT); localStorage.removeItem(GOOGLE_LAST_PAGE); - Cookies.set(TOKEN_COOKIE_NAME, response.token); + Cookies.set(TOKEN_COOKIE_NAME, response.token, { + path: '/', + expires: 30, + }); window.location.href = redirectUrl; }) .catch((err) => { diff --git a/src/components/AuthenticationFlow/ResetPasswordForm.tsx b/src/components/AuthenticationFlow/ResetPasswordForm.tsx index cbf77e6d4..21c76dd99 100644 --- a/src/components/AuthenticationFlow/ResetPasswordForm.tsx +++ b/src/components/AuthenticationFlow/ResetPasswordForm.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from 'preact/hooks'; import { httpPost } from '../../lib/http'; import Cookies from 'js-cookie'; -import {TOKEN_COOKIE_NAME} from "../../lib/jwt"; +import { TOKEN_COOKIE_NAME } from '../../lib/jwt'; export default function ResetPasswordForm() { const [code, setCode] = useState(''); @@ -53,7 +53,10 @@ export default function ResetPasswordForm() { } const token = response.token; - Cookies.set(TOKEN_COOKIE_NAME, token); + Cookies.set(TOKEN_COOKIE_NAME, token, { + path: '/', + expires: 30, + }); window.location.href = '/'; }; diff --git a/src/components/AuthenticationFlow/TriggerVerifyAccount.tsx b/src/components/AuthenticationFlow/TriggerVerifyAccount.tsx index 2ea766d31..2b96785cf 100644 --- a/src/components/AuthenticationFlow/TriggerVerifyAccount.tsx +++ b/src/components/AuthenticationFlow/TriggerVerifyAccount.tsx @@ -27,7 +27,10 @@ export function TriggerVerifyAccount() { return; } - Cookies.set(TOKEN_COOKIE_NAME, response.token); + Cookies.set(TOKEN_COOKIE_NAME, response.token, { + path: '/', + expires: 30, + }); window.location.href = '/'; }) .catch((err) => {