ultisuite-client/lib/auth/recovery-flow-query.ts
R3D347HR4Y ee05c804f9
Some checks are pending
E2E / Playwright e2e (push) Waiting to run
feat(auth): MFA stages and embedded recovery reset flow
Add authenticator-validate device picker, captcha/frame stages, WebAuthn
utils fix, and recovery query parsing for /reset-password links.
2026-06-20 01:21:29 +02:00

18 lines
615 B
TypeScript

/** Build Authentik executor `query` param from a reset-password URL. */
export function buildRecoveryFlowQuery(searchParams: URLSearchParams): string | undefined {
const nested = searchParams.get("query")?.trim()
if (nested) return nested
const token = searchParams.get("flow_token")?.trim()
if (token) {
return `flow_token=${encodeURIComponent(token)}`
}
const parts: string[] = []
searchParams.forEach((value, key) => {
if (key === "returnTo") return
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
})
return parts.length > 0 ? parts.join("&") : undefined
}