mirror of
https://github.com/bitbaum/heidi.git
synced 2026-12-04 05:17:27 +01:00
* wip(accounts): Heidi on @bitbaum/accountkit/auth (accountkit pin pending) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QDMxjTqKNLXETMYYuapMa3 * feat(accounts): Heidi has its own accounts; OrangeCat is one way in, not the only one Email and password, passkeys and two-step codes from @bitbaum/accountkit/auth, with the shared screens in Heidi's seven languages. People whose first way in was OrangeCat keep their actor id, so no row moves. next-auth removed; the session secret falls back to the existing AUTH_SECRET. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QDMxjTqKNLXETMYYuapMa3 --------- Co-authored-by: Claude <noreply@anthropic.com>
25 lines
1018 B
TypeScript
25 lines
1018 B
TypeScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { localeIn, safeReturn, signInPath } from "./paths.ts";
|
|
|
|
test("the sign-in page speaks the language of the page the person came from", () => {
|
|
assert.equal(localeIn("/fr/chat"), "fr");
|
|
assert.equal(localeIn("/api/account/language?next=%2Fru%2Fportal"), "ru");
|
|
assert.equal(localeIn("/api/account/language?next=%2Fgsw%2Fsettings"), "gsw");
|
|
assert.equal(localeIn("/nowhere"), "de");
|
|
});
|
|
|
|
test("the return path is always on this site", () => {
|
|
assert.equal(safeReturn("//evil.example"), "/de");
|
|
assert.equal(safeReturn("/\\evil.example"), "/de");
|
|
assert.equal(safeReturn("https://evil.example"), "/de");
|
|
assert.equal(safeReturn("/it/groups/1"), "/it/groups/1");
|
|
});
|
|
|
|
test("signing in from a page lands on that language's sign-in screen and comes back", () => {
|
|
assert.equal(
|
|
signInPath("/api/account/language?next=%2Fit%2Fchat"),
|
|
"/it/sign-in?next=%2Fapi%2Faccount%2Flanguage%3Fnext%3D%252Fit%252Fchat",
|
|
);
|
|
});
|