Clear account idb table on logout (#28996)

* Clear account idb table on logout

to remove old deactivated refresh token when logging out

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Simplify code

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix test

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-01-14 12:01:19 +00:00
committed by GitHub
parent 5882b004f5
commit 2559cba482
3 changed files with 47 additions and 36 deletions

View File

@@ -1049,9 +1049,9 @@ async function clearStorage(opts?: { deleteEverything?: boolean }): Promise<void
window.localStorage.clear();
try {
await StorageAccess.idbDelete("account", ACCESS_TOKEN_STORAGE_KEY);
await StorageAccess.idbClear("account");
} catch (e) {
logger.error("idbDelete failed for account:mx_access_token", e);
logger.error("idbClear failed for account", e);
}
// now restore those invites, registration time and previously set device language