mirror of
https://github.com/bitbaum/causius.git
synced 2026-12-04 05:07:50 +01:00
* fix(auth): adopt shared account forms and recovery * fix(auth): use released all-method second-factor protection
26 lines
897 B
TypeScript
26 lines
897 B
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { accountDestination } from "./entry";
|
|
|
|
describe("account return routes", () => {
|
|
it("localizes unprefixed paths once and preserves localized callback queries", () => {
|
|
expect(accountDestination("de", "/account")).toBe("/de/account");
|
|
expect(
|
|
accountDestination("de", "/de/account?section=security#methods"),
|
|
).toBe("/de/account?section=security#methods");
|
|
expect(accountDestination("fr", "/it/account")).toBe("/it/account");
|
|
});
|
|
it("rejects external destinations and sign-in loops", () => {
|
|
const fallback = accountDestination("de");
|
|
for (const next of [
|
|
"https://attacker.example",
|
|
"//attacker.example",
|
|
"/\\attacker.example",
|
|
"/sign-in",
|
|
"/de/sign-in?next=/account",
|
|
"/fr/sign-up",
|
|
]) {
|
|
expect(accountDestination("de", next)).toBe(fallback);
|
|
}
|
|
});
|
|
});
|