summaryrefslogtreecommitdiff
path: root/packages/frontend
diff options
context:
space:
mode:
authornexryai <61890205+nexryai@users.noreply.github.com>2025-02-01 13:33:37 +0900
committerGitHub <noreply@github.com>2025-02-01 13:33:37 +0900
commit77e421029cb564a97f42b6e41c9edce49f79cecd (patch)
tree3b2b55e8da40f6bde9991b7158c945161a0a894c /packages/frontend
parent[skip ci] Update CHANGELOG.md (prepend template) (diff)
downloadsharkey-77e421029cb564a97f42b6e41c9edce49f79cecd.tar.gz
sharkey-77e421029cb564a97f42b6e41c9edce49f79cecd.tar.bz2
sharkey-77e421029cb564a97f42b6e41c9edce49f79cecd.zip
Merge commit from fork
* fix(frontend): Improve cookie attributes * fix(frontend): Delete an old authentication cookie in fetchAccount
Diffstat (limited to 'packages/frontend')
-rw-r--r--packages/frontend/src/account.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/frontend/src/account.ts b/packages/frontend/src/account.ts
index 36186ecac1..2f9a887720 100644
--- a/packages/frontend/src/account.ts
+++ b/packages/frontend/src/account.ts
@@ -101,6 +101,9 @@ export async function removeAccount(idOrToken: Account['id']) {
}
function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Promise<Account> {
+ document.cookie = "token=; path=/; max-age=0";
+ document.cookie = `token=${token}; path=/queue; max-age=86400; SameSite=Strict; Secure`; // bull dashboardの認証とかで使う
+
return new Promise((done, fail) => {
window.fetch(`${apiUrl}/i`, {
method: 'POST',
@@ -213,7 +216,6 @@ export async function login(token: Account['token'], redirect?: string) {
throw reason;
});
miLocalStorage.setItem('account', JSON.stringify(me));
- document.cookie = `token=${token}; path=/; max-age=31536000`; // bull dashboardの認証とかで使う
await addAccount(me.id, token);
if (redirect) {