fix: redirect loop on stale cookie, login broken for 64-char keys, stale docs

- /dashboard now validates key before redirecting to /home — bad/old keys
  clear the cookie and show login instead of looping
- Login form: remove old 4-group auto-formatter, fix maxlength 19→64,
  fix min length validation 19→10, update placeholder
- New key display: break-all so 64-char hex wraps properly
- docs.html: update example key format and description
This commit is contained in:
M1
2026-03-17 06:22:16 +04:00
parent 6bdd76b4f0
commit b8ac4e7b1f
3 changed files with 16 additions and 17 deletions
+8 -2
View File
@@ -80,8 +80,14 @@ export const dashboard = new Elysia()
.get("/dashboard/query-builder.js", () => Bun.file(`${dashDir}/query-builder.js`))
// Login page
.get("/dashboard", ({ cookie }) => {
if (cookie?.pingql_key?.value) return redirect("/dashboard/home");
.get("/dashboard", async ({ cookie }) => {
const key = cookie?.pingql_key?.value;
if (key) {
const resolved = await resolveKey(key);
if (resolved) return redirect("/dashboard/home");
// Invalid/stale key — clear it and show login
cookie.pingql_key?.remove();
}
return Bun.file(`${dashDir}/index.html`);
})