Skip to content

Commit de3b54d

Browse files
committed
remove leftover cookie
1 parent 279e7aa commit de3b54d

File tree

2 files changed

+6
-30
lines changed

2 files changed

+6
-30
lines changed

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/background.ts

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
2828
clearTimeout(autolockTimeout);
2929
setAutolock();
3030
} else if (message.action === "passphrase") {
31-
sendResponse(getCachedPassphrase());
31+
sendResponse(cachedPassphrase);
3232
} else if (["dropbox", "drive"].indexOf(message.action) > -1) {
3333
getBackupToken(message.action);
3434
} else if (message.action === "lock") {
@@ -415,9 +415,6 @@ async function setAutolock() {
415415

416416
if (enforcedAutolock) {
417417
if (enforcedAutolock > 0) {
418-
document.cookie = `passphrase="${getCachedPassphrase()}${getCookieExpiry(
419-
enforcedAutolock
420-
)}"`;
421418
autolockTimeout = window.setTimeout(() => {
422419
cachedPassphrase = "";
423420
}, enforcedAutolock * 60000);
@@ -426,9 +423,6 @@ async function setAutolock() {
426423
}
427424

428425
if (Number(localStorage.autolock) > 0) {
429-
document.cookie = `passphrase="${getCachedPassphrase()}${getCookieExpiry(
430-
Number(localStorage.autolock)
431-
)}"`;
432426
autolockTimeout = window.setTimeout(() => {
433427
cachedPassphrase = "";
434428
const id = contentTab.id;
@@ -446,21 +440,3 @@ function getCookieExpiry(time: number) {
446440

447441
return `;expires=${autolockExpiry}`;
448442
}
449-
450-
function getCachedPassphrase() {
451-
if (cachedPassphrase) {
452-
return cachedPassphrase;
453-
}
454-
455-
const cookie = document.cookie;
456-
const cookieMatch = cookie
457-
? document.cookie.match(/passphrase=([^;]*)/)
458-
: null;
459-
const cookiePassphrase =
460-
cookieMatch && cookieMatch.length > 1 ? cookieMatch[1] : null;
461-
if (cookiePassphrase) {
462-
return cookiePassphrase;
463-
}
464-
465-
return "";
466-
}

0 commit comments

Comments
 (0)