MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / formFields

Function formFields

apps/host-selfhost/src/auth/sso.test.ts:194–203  ·  view source on GitHub ↗
(form: string)

Source from the content-addressed store, hash-verified

192 .replaceAll(">", ">");
193
194const formFields = (form: string): Record<string, string> => {
195 const fields: Record<string, string> = {};
196 for (const input of form.matchAll(/<input\b[^>]*>/gi)) {
197 const tag = input[0];
198 const name = tag.match(/\bname=["']([^"']+)["']/i)?.[1];
199 const value = tag.match(/\bvalue=["']([^"']*)["']/i)?.[1] ?? "";
200 if (name) fields[decodeHtml(name)] = decodeHtml(value);
201 }
202 return fields;
203};
204
205// Drive the whole flow as the given IdP account: sign-in redirect -> IdP
206// consent page (pick the account's form) -> callback back into the app.

Callers 1

signInThroughIdpFunction · 0.85

Calls 1

decodeHtmlFunction · 0.70

Tested by

no test coverage detected