(form: string)
| 192 | .replaceAll(">", ">"); |
| 193 | |
| 194 | const 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. |
no test coverage detected