diff options
| -rw-r--r-- | docs/dashboard.md | 4 | ||||
| -rw-r--r-- | src/api/dashboard/dashboard.html | 20 |
2 files changed, 21 insertions, 3 deletions
diff --git a/docs/dashboard.md b/docs/dashboard.md index 4948c03..ec99f97 100644 --- a/docs/dashboard.md +++ b/docs/dashboard.md @@ -27,7 +27,9 @@ dashboard is open (half way through the token's life, looked at again when the p shows, so after the computer slept too) until the login ends (`--session-lifetime`), then back to the login page; it ends with the token's lifetime once not renewed, or with "Log out of this browser" on the login page, or "log out" in the user's menu on the dashboard (its -name, top right), which ends this browser's session only. Where the page got in by +name, top right), which ends this browser's session only: the page stops reading +and goes to the login page, and brought back by the browser's back button it loads +again, so it shows nothing from before. Where the page got in by what it can't end, the proxy's, "log out" is greyed, and says how instead. The menu's "credentials…" shows the user's keys, each by its name and as much of the key as fits the dialog, cut in the middle where it doesn't (its end and comment always shown, the whole in its tooltip), and `edit` at the right: its name diff --git a/src/api/dashboard/dashboard.html b/src/api/dashboard/dashboard.html index dd37f29..a20e64c 100644 --- a/src/api/dashboard/dashboard.html +++ b/src/api/dashboard/dashboard.html @@ -2719,7 +2719,7 @@ async function logOut() { "The page is let in still, by other means.")); obtainTokens(); } catch (_) { - location.assign("../login"); + toLogin(); } } // The user's credentials: its keys (`/auth/keys`): each edited (its name, its line), @@ -2904,7 +2904,7 @@ async function obtainTokens() { showWho(); // The login ended (or none): to the login page; else (the node away) again soon. if ([400, 401, 403].includes(error.status)) { - location.assign("../login"); + toLogin(); return; } tokenTimer = setTimeout(obtainTokens, 30000); @@ -4374,6 +4374,22 @@ remakeForm.addEventListener("submit", event => { .catch(error => remakeResult("Proposing failed: " + error, true)); }); +// To the login page, the page's reading stopped first: its stream, its subscriptions, +// its timers and tokens. A page the browser brings back from its history as it was +// (back, forward: `pageshow` of a page kept whole) is loaded again instead, so it shows +// nothing its session no longer lets it read, and goes to the login page without one. +function toLogin() { + clearTimeout(retry); + retry = null; + if (events) events.close(); + for (const entry of subscribed.values()) entry.stop(); + subscribed.clear(); + clearTimeout(tokenTimer); + clearTimeout(figuresTimer); + token = narrowToken = null; + location.assign("../login"); +} +addEventListener("pageshow", event => { if (event.persisted) location.reload(); }); // Opened from another member's page (`handOver`) with a token: it begins this browser's // session here before anything is read, with no login page in between. Without a // session, `obtainTokens` goes to the login page. |
