Some checks are pending
E2E / Playwright e2e (push) Waiting to run
Add authenticator-validate device picker, captcha/frame stages, WebAuthn utils fix, and recovery query parsing for /reset-password links.
18 lines
615 B
TypeScript
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
|
|
}
|