\n | function pasteCode(code: string) { | \n
\n | const _inputBoxes = document.getElementsByTagName(\"input\"); | \n
\n | const inputBoxes: HTMLInputElement[] = []; | \n
\n | for (let i = 0; i < _inputBoxes.length; i++) { | \n
\n | if ( | \n
\n | _inputBoxes[i].type === \"text\" || | \n
\n | _inputBoxes[i].type === \"number\" || | \n
\n | _inputBoxes[i].type === \"tel\" || | \n
\n | _inputBoxes[i].type === \"password\" | \n
\n | ) { | \n
\n | inputBoxes.push(_inputBoxes[i]); | \n
\n | } | \n
\n | } | \n
\n | if (!inputBoxes.length) { | \n
\n | return; | \n
\n | } | \n
\n | const identities = [ | \n
\n | \"2fa\", | \n
\n | \"otp\", | \n
\n | \"authenticator\", | \n
\n | \"factor\", | \n
\n | \"code\", | \n
\n | \"totp\", | \n
\n | \"twoFactorCode\", | \n
\n | ]; | \n
\n | for (const inputBox of inputBoxes) { | \n
\n | for (const identity of identities) { | \n
\n | if ( | \n
\n | inputBox.name.toLowerCase().indexOf(identity) >= 0 || | \n
\n | inputBox.id.toLowerCase().indexOf(identity) >= 0 | \n
\n | ) { | \n
\n | if (!inputBox.value || /^(\\d{6}|\\d{8})$/.test(inputBox.value)) { | \n
\n | inputBox.value = code; | \n
\n | fireInputEvents(inputBox); | \n
\n | } | \n
\n | return; | \n
\n | } | \n
\n | } | \n
\n | } | \n
-
I've been using this for some time, and noticed that in many sites, after I click on my code, it auto-copies to the MFA field on the website. I'm also a developer and maintain a application. It has MFA, and this doesn't happen on this site. What attributes or causing this to happen? What do I need to do on the website to make this work? |
Beta Was this translation helpful? Give feedback.
-
Here's our logic for autofill: Lines 285 to 323 in 9d9660b |
Beta Was this translation helpful? Give feedback.
Here's our logic for autofill:
Authenticator/src/content.ts
Lines 285 to 323 in 9d9660b