Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update TOTP field detection in browser extension, cleanup tests (#1848)
Leendert de Borst0e0818c19269
diff --git a/apps/browser-extension/src/utils/formDetector/FieldPatterns.ts b/apps/browser-extension/src/utils/formDetector/FieldPatterns.tsindex 22b0cab48..39603f1b5 100644--- a/apps/browser-extension/src/utils/formDetector/FieldPatterns.ts+++ b/apps/browser-extension/src/utils/formDetector/FieldPatterns.ts@@ -60,7 +60,7 @@ export const EnglishFieldPatterns: FieldPatterns = {birthDateDay: ['-day', 'birthdate_d', 'birthdayday', '_day', 'day'],birthDateMonth: ['-month', 'birthdate_m', 'birthdaymonth', '_month', 'month'],birthDateYear: ['-year', 'birthdate_y', 'birthdayyear', '_year', 'year'],- totp: ['totp', 'otp', 'one-time', 'onetime', 'six-digit', 'digit-code', 'token', 'authenticator', '2fa', 'twofa', 'two-factor', 'mfa', 'security-code', 'auth-code', 'passcode', 'pin-code', 'pincode', 'google_code', 'verification-code', 'verificationcode', 'tfa', 'tfacode', 'second-factor']+ totp: ['totp', 'otp', 'one-time', 'onetime', 'six-digit', 'digit-code', 'token', 'authenticator', 'authentication', '2fa', 'twofa', 'two-factor', 'mfa', 'security-code', 'auth-code', 'passcode', 'pin-code', 'pincode', 'google_code', 'verification-code', 'verificationcode', 'tfa', 'tfacode', 'second-factor', 'one time password']};/**diff --git a/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.emby-connect-sv.test.ts b/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.emby-connect-sv.test.tsdeleted file mode 100644index cd4d6e701..000000000--- a/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.emby-connect-sv.test.ts+++ /dev/null@@ -1,95 +0,0 @@-import { describe, it, expect } from 'vitest';--import { FormDetector } from '../FormDetector';--import { createTestDom } from './TestUtils';--describe('FormDetector - Emby Connect login form (Swedish)', () => {- const htmlFile = 'emby-connect-login-sv.html';-- it('should detect login form with Swedish labels', () => {- const dom = createTestDom(htmlFile);- const document = dom.window.document;- const formDetector = new FormDetector(document);- expect(formDetector.containsLoginForm()).toBe(true);- });-- it('should detect Swedish "E-post" label as email field', () => {- const dom = createTestDom(htmlFile);- const document = dom.window.document;-- // Click on the email field with Swedish label- const emailInput = document.getElementById('embyinput0');- const formDetector = new FormDetector(document, emailInput as HTMLElement);- const form = formDetector.getForm();-- expect(form).toBeTruthy();-- // Should detect the email field based on Swedish "E-post" label- expect(form?.emailField).toBeTruthy();- expect(form?.emailField?.id).toBe('embyinput0');- expect(form?.emailField?.className).toContain('txtUser');- });-- it('should detect Swedish "Lösenord" label as password field', () => {- const dom = createTestDom(htmlFile);- const document = dom.window.document;-- // Click on the password field with Swedish label- const passwordInput = document.getElementById('embyinput1');- const formDetector = new FormDetector(document, passwordInput as HTMLElement);- const form = formDetector.getForm();-- expect(form).toBeTruthy();-- // Should detect the password field based on Swedish "Lösenord" label- expect(form?.passwordField).toBeTruthy();- expect(form?.passwordField?.id).toBe('embyinput1');- expect(form?.passwordField?.className).toContain('txtPassword');- });-- it('should ignore hidden fake fields in Swedish form', () => {- const dom = createTestDom(htmlFile);- const document = dom.window.document;-- const emailInput = document.getElementById('embyinput0');- const formDetector = new FormDetector(document, emailInput as HTMLElement);- const form = formDetector.getForm();-- expect(form).toBeTruthy();-- // Should not detect fake fields- expect(form?.emailField?.name).not.toBe('fakeusernameremembered');- expect(form?.passwordField?.name).not.toBe('fakepasswordremembered');- });-- it('should not trigger autofill on fake Swedish form fields', () => {- const dom = createTestDom(htmlFile);- const document = dom.window.document;-- const fakeField = document.querySelector('input[name="fakeusernameremembered"]');- const formDetector = new FormDetector(document, fakeField as HTMLElement);-- expect(formDetector.isAutofillTriggerableField()).toBe(false);- });-- it('should trigger autofill on real Swedish email field', () => {- const dom = createTestDom(htmlFile);- const document = dom.window.document;-- const emailInput = document.getElementById('embyinput0');- const formDetector = new FormDetector(document, emailInput as HTMLElement);-- expect(formDetector.isAutofillTriggerableField()).toBe(true);- });-- it('should trigger autofill on real Swedish password field', () => {- const dom = createTestDom(htmlFile);- const document = dom.window.document;-- const passwordInput = document.getElementById('embyinput1');- const formDetector = new FormDetector(document, passwordInput as HTMLElement);-- expect(formDetector.isAutofillTriggerableField()).toBe(true);- });-});diff --git a/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.emby-connect.test.ts b/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.emby-connect.test.tsdeleted file mode 100644index a27238169..000000000--- a/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.emby-connect.test.ts+++ /dev/null@@ -1,73 +0,0 @@-import { describe, it, expect } from 'vitest';--import { FormDetector } from '../FormDetector';--import { createTestDom } from './TestUtils';--describe('FormDetector - Emby Connect login form', () => {- const htmlFile = 'emby-connect-login.html';-- it('should detect login form', () => {- const dom = createTestDom(htmlFile);- const document = dom.window.document;- const formDetector = new FormDetector(document);- expect(formDetector.containsLoginForm()).toBe(true);- });-- it('should ignore hidden fake username/password fields with height:0', () => {- const dom = createTestDom(htmlFile);- const document = dom.window.document;-- // Click on the real email/username field- const emailInput = document.getElementById('embyinput0');- const formDetector = new FormDetector(document, emailInput as HTMLElement);- const form = formDetector.getForm();-- expect(form).toBeTruthy();-- /*- * Should detect the real email field (labeled as "Email" in the form), not the fake username field- * This field can be used for username/email login- */- expect(form?.emailField).toBeTruthy();- expect(form?.emailField?.className).toContain('txtUser');- expect(form?.emailField?.id).toBe('embyinput0');-- // Should detect the real password field (txtPassword), not the fake one- expect(form?.passwordField).toBeTruthy();- expect(form?.passwordField?.className).toContain('txtPassword');- expect(form?.passwordField?.name).not.toBe('fakepasswordremembered');- });-- it('should not autofill hidden fake fields', () => {- const dom = createTestDom(htmlFile);- const document = dom.window.document;-- // Click on the fake username field (should not be detected as autofillable)- const fakeUsernameInput = document.querySelector('input[name="fakeusernameremembered"]');- const formDetector = new FormDetector(document, fakeUsernameInput as HTMLElement);-- // Should not consider the fake field as an autofill-triggerable field- expect(formDetector.isAutofillTriggerableField()).toBe(false);- });-- it('should detect real username field when clicked', () => {- const dom = createTestDom(htmlFile);- const document = dom.window.document;-- const usernameInput = document.getElementById('embyinput0');- const formDetector = new FormDetector(document, usernameInput as HTMLElement);-- expect(formDetector.isAutofillTriggerableField()).toBe(true);- });-- it('should detect real password field when clicked', () => {- const dom = createTestDom(htmlFile);- const document = dom.window.document;-- const passwordInput = document.getElementById('embyinput1');- const formDetector = new FormDetector(document, passwordInput as HTMLElement);-- expect(formDetector.isAutofillTriggerableField()).toBe(true);- });-});diff --git a/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.en.test.ts b/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.en.test.tsindex fd79821f1..112c3fc23 100644--- a/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.en.test.ts+++ b/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.en.test.ts@@ -1,6 +1,8 @@import { describe, expect, it } from 'vitest';-import { FormField, testField } from './TestUtils';+import { FormDetector } from '../FormDetector';++import { FormField, testField, createTestDom } from './TestUtils';describe('FormDetector English tests', () => {it('contains tests for English form field detection', () => {@@ -111,4 +113,150 @@ describe('FormDetector English tests', () => {testField(FormField.Email, 'form-group--1', htmlFile);});+ describe('English login form 3 detection (Emby Connect)', () => {+ const htmlFile = 'en-login-form3.html';++ testField(FormField.Email, 'embyinput0', htmlFile);+ testField(FormField.Password, 'embyinput1', htmlFile);++ it('should detect login form', () => {+ const dom = createTestDom(htmlFile);+ const document = dom.window.document;+ const formDetector = new FormDetector(document);+ expect(formDetector.containsLoginForm()).toBe(true);+ });++ it('should ignore hidden fake username/password fields with height:0', () => {+ const dom = createTestDom(htmlFile);+ const document = dom.window.document;++ const emailInput = document.getElementById('embyinput0');+ const formDetector = new FormDetector(document, emailInput as HTMLElement);+ const form = formDetector.getForm();++ expect(form).toBeTruthy();+ expect(form?.emailField).toBeTruthy();+ expect(form?.emailField?.className).toContain('txtUser');+ expect(form?.emailField?.id).toBe('embyinput0');+ expect(form?.passwordField).toBeTruthy();+ expect(form?.passwordField?.className).toContain('txtPassword');+ expect(form?.passwordField?.name).not.toBe('fakepasswordremembered');+ });++ it('should not autofill hidden fake fields', () => {+ const dom = createTestDom(htmlFile);+ const document = dom.window.document;++ const fakeUsernameInput = document.querySelector('input[name="fakeusernameremembered"]');+ const formDetector = new FormDetector(document, fakeUsernameInput as HTMLElement);++ expect(formDetector.isAutofillTriggerableField()).toBe(false);+ });++ it('should detect real username field when clicked', () => {+ const dom = createTestDom(htmlFile);+ const document = dom.window.document;++ const usernameInput = document.getElementById('embyinput0');+ const formDetector = new FormDetector(document, usernameInput as HTMLElement);++ expect(formDetector.isAutofillTriggerableField()).toBe(true);+ });++ it('should detect real password field when clicked', () => {+ const dom = createTestDom(htmlFile);+ const document = dom.window.document;++ const passwordInput = document.getElementById('embyinput1');+ const formDetector = new FormDetector(document, passwordInput as HTMLElement);++ expect(formDetector.isAutofillTriggerableField()).toBe(true);+ });+ });++ describe('English login form 4 detection (Emby Connect - Swedish)', () => {+ const htmlFile = 'en-login-form4.html';++ testField(FormField.Email, 'embyinput0', htmlFile);+ testField(FormField.Password, 'embyinput1', htmlFile);++ it('should detect login form with Swedish labels', () => {+ const dom = createTestDom(htmlFile);+ const document = dom.window.document;+ const formDetector = new FormDetector(document);+ expect(formDetector.containsLoginForm()).toBe(true);+ });++ it('should detect Swedish "E-post" label as email field', () => {+ const dom = createTestDom(htmlFile);+ const document = dom.window.document;++ const emailInput = document.getElementById('embyinput0');+ const formDetector = new FormDetector(document, emailInput as HTMLElement);+ const form = formDetector.getForm();++ expect(form).toBeTruthy();+ expect(form?.emailField).toBeTruthy();+ expect(form?.emailField?.id).toBe('embyinput0');+ expect(form?.emailField?.className).toContain('txtUser');+ });++ it('should detect Swedish "Lösenord" label as password field', () => {+ const dom = createTestDom(htmlFile);+ const document = dom.window.document;++ const passwordInput = document.getElementById('embyinput1');+ const formDetector = new FormDetector(document, passwordInput as HTMLElement);+ const form = formDetector.getForm();++ expect(form).toBeTruthy();+ expect(form?.passwordField).toBeTruthy();+ expect(form?.passwordField?.id).toBe('embyinput1');+ expect(form?.passwordField?.className).toContain('txtPassword');+ });++ it('should ignore hidden fake fields in Swedish form', () => {+ const dom = createTestDom(htmlFile);+ const document = dom.window.document;++ const emailInput = document.getElementById('embyinput0');+ const formDetector = new FormDetector(document, emailInput as HTMLElement);+ const form = formDetector.getForm();++ expect(form).toBeTruthy();+ expect(form?.emailField?.name).not.toBe('fakeusernameremembered');+ expect(form?.passwordField?.name).not.toBe('fakepasswordremembered');+ });++ it('should not trigger autofill on fake Swedish form fields', () => {+ const dom = createTestDom(htmlFile);+ const document = dom.window.document;++ const fakeField = document.querySelector('input[name="fakeusernameremembered"]');+ const formDetector = new FormDetector(document, fakeField as HTMLElement);++ expect(formDetector.isAutofillTriggerableField()).toBe(false);+ });++ it('should trigger autofill on real Swedish email field', () => {+ const dom = createTestDom(htmlFile);+ const document = dom.window.document;++ const emailInput = document.getElementById('embyinput0');+ const formDetector = new FormDetector(document, emailInput as HTMLElement);++ expect(formDetector.isAutofillTriggerableField()).toBe(true);+ });++ it('should trigger autofill on real Swedish password field', () => {+ const dom = createTestDom(htmlFile);+ const document = dom.window.document;++ const passwordInput = document.getElementById('embyinput1');+ const formDetector = new FormDetector(document, passwordInput as HTMLElement);++ expect(formDetector.isAutofillTriggerableField()).toBe(true);+ });+ });+});diff --git a/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.entra-id-2fa.test.ts b/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.entra-id-2fa.test.tsdeleted file mode 100644index a11c48e12..000000000--- a/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.entra-id-2fa.test.ts+++ /dev/null@@ -1,88 +0,0 @@-import { beforeEach, describe, expect, it } from 'vitest';--import { FormDetector } from '../FormDetector';-import { DetectedFieldType } from '../types/FormFields';--import { createTestDom } from './TestUtils';--describe('FormDetector - Microsoft Entra ID 2FA', () => {- const htmlFile = 'entra-id-2fa.html';- let document: Document;- let formDetector: FormDetector;-- beforeEach(() => {- const dom = createTestDom(htmlFile);- document = dom.window.document;- });-- describe('TOTP field detection', () => {- it('should detect the 2FA code input field as TOTP', () => {- const totpInput = document.getElementById('idTxtBx_SAOTCC_OTC') as HTMLInputElement;- expect(totpInput).toBeTruthy();-- formDetector = new FormDetector(document, totpInput);-- const detectedType = formDetector.getDetectedFieldType();- expect(detectedType).toBe(DetectedFieldType.Totp);- });-- it('should find the TOTP field when searching from form', () => {- formDetector = new FormDetector(document, document.body);-- const totpField = formDetector.findTotpField();- expect(totpField).toBeTruthy();- expect(totpField?.id).toBe('idTxtBx_SAOTCC_OTC');- });-- it('should detect TOTP field with maxlength=6', () => {- const totpInput = document.getElementById('idTxtBx_SAOTCC_OTC') as HTMLInputElement;- expect(totpInput.maxLength).toBe(6);- expect(totpInput.type).toBe('tel');- });-- it('should recognize form contains login fields for TOTP', () => {- formDetector = new FormDetector(document, document.body);-- const containsLogin = formDetector.containsLoginForm();- expect(containsLogin).toBe(true);- });- });-- describe('Form structure', () => {- it('should find hidden mfaAuthMethod input', () => {- const mfaMethod = document.querySelector('input[name="mfaAuthMethod"]') as HTMLInputElement;- expect(mfaMethod).toBeTruthy();- expect(mfaMethod.value).toBe('PhoneAppOTP');- });-- it('should find the submit button', () => {- const submitBtn = document.getElementById('idSubmit_SAOTCC_Continue') as HTMLInputElement;- expect(submitBtn).toBeTruthy();- expect(submitBtn.type).toBe('submit');- expect(submitBtn.value).toBe('Verify');- });-- it('should detect aria-label for accessibility', () => {- const totpInput = document.getElementById('idTxtBx_SAOTCC_OTC') as HTMLInputElement;- expect(totpInput.getAttribute('aria-label')).toBe('Code');- });- });-- describe('TOTP field attributes', () => {- it('should have autocomplete disabled', () => {- const totpInput = document.getElementById('idTxtBx_SAOTCC_OTC') as HTMLInputElement;- expect(totpInput.autocomplete).toBe('off');- });-- it('should be marked as required', () => {- const totpInput = document.getElementById('idTxtBx_SAOTCC_OTC') as HTMLInputElement;- expect(totpInput.getAttribute('aria-required')).toBe('true');- });-- it('should have proper ARIA descriptions', () => {- const totpInput = document.getElementById('idTxtBx_SAOTCC_OTC') as HTMLInputElement;- const describedBy = totpInput.getAttribute('aria-describedby');- expect(describedBy).toContain('idDiv_SAOTCC_Description');- });- });-});diff --git a/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.totp.test.ts b/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.totp.test.tsindex 4a2b99612..ed230bc05 100644--- a/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.totp.test.ts+++ b/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.totp.test.ts@@ -2,11 +2,12 @@ import { readFileSync } from 'fs';import { join } from 'path';import { JSDOM } from 'jsdom';-import { describe, expect, it } from 'vitest';+import { beforeEach, describe, expect, it } from 'vitest';import { FormDetector } from '@/utils/formDetector/FormDetector';+import { DetectedFieldType } from '@/utils/formDetector/types/FormFields';-import { FormField, testField } from './TestUtils';+import { FormField, testField, createTestDom } from './TestUtils';describe('FormDetector TOTP tests', () => {it('contains tests for TOTP field detection', () => {@@ -67,6 +68,96 @@ describe('FormDetector TOTP tests', () => {testField(FormField.Totp, 'code', htmlFile);});+ describe('English TOTP form 9 detection (InfinityFree 2FA Setup)', () => {+ const htmlFile = 'en-totp-form9.html';++ testField(FormField.Totp, 'code', htmlFile);+ });++ describe('English TOTP form 10 detection (InfinityFree 2FA Challenge)', () => {+ const htmlFile = 'en-totp-form10.html';++ testField(FormField.Totp, 'code', htmlFile);+ });++ describe('English TOTP form 11 detection (Microsoft Entra ID 2FA)', () => {+ const htmlFile = 'en-totp-form11.html';+ let document: Document;+ let formDetector: FormDetector;++ beforeEach(() => {+ const dom = createTestDom(htmlFile);+ document = dom.window.document;+ });++ testField(FormField.Totp, 'idTxtBx_SAOTCC_OTC', htmlFile);++ it('should detect the 2FA code input field as TOTP', () => {+ const totpInput = document.getElementById('idTxtBx_SAOTCC_OTC') as HTMLInputElement;+ expect(totpInput).toBeTruthy();++ formDetector = new FormDetector(document, totpInput);++ const detectedType = formDetector.getDetectedFieldType();+ expect(detectedType).toBe(DetectedFieldType.Totp);+ });++ it('should find the TOTP field when searching from form', () => {+ formDetector = new FormDetector(document, document.body);++ const form = formDetector.getForm();+ expect(form?.totpField).toBeTruthy();+ expect(form?.totpField?.id).toBe('idTxtBx_SAOTCC_OTC');+ });++ it('should detect TOTP field with maxlength=6', () => {+ const totpInput = document.getElementById('idTxtBx_SAOTCC_OTC') as HTMLInputElement;+ expect(totpInput.maxLength).toBe(6);+ expect(totpInput.type).toBe('tel');+ });++ it('should recognize form contains login fields for TOTP', () => {+ formDetector = new FormDetector(document, document.body);++ const containsLogin = formDetector.containsLoginForm();+ expect(containsLogin).toBe(true);+ });++ it('should find hidden mfaAuthMethod input', () => {+ const mfaMethod = document.querySelector('input[name="mfaAuthMethod"]') as HTMLInputElement;+ expect(mfaMethod).toBeTruthy();+ expect(mfaMethod.value).toBe('PhoneAppOTP');+ });++ it('should find the submit button', () => {+ const submitBtn = document.getElementById('idSubmit_SAOTCC_Continue') as HTMLInputElement;+ expect(submitBtn).toBeTruthy();+ expect(submitBtn.type).toBe('submit');+ expect(submitBtn.value).toBe('Verify');+ });++ it('should detect aria-label for accessibility', () => {+ const totpInput = document.getElementById('idTxtBx_SAOTCC_OTC') as HTMLInputElement;+ expect(totpInput.getAttribute('aria-label')).toBe('Code');+ });++ it('should have autocomplete disabled', () => {+ const totpInput = document.getElementById('idTxtBx_SAOTCC_OTC') as HTMLInputElement;+ expect(totpInput.autocomplete).toBe('off');+ });++ it('should be marked as required', () => {+ const totpInput = document.getElementById('idTxtBx_SAOTCC_OTC') as HTMLInputElement;+ expect(totpInput.getAttribute('aria-required')).toBe('true');+ });++ it('should have proper ARIA descriptions', () => {+ const totpInput = document.getElementById('idTxtBx_SAOTCC_OTC') as HTMLInputElement;+ const describedBy = totpInput.getAttribute('aria-describedby');+ expect(describedBy).toContain('idDiv_SAOTCC_Description');+ });+ });+describe('Email verification form should NOT be detected as TOTP', () => {it('should NOT detect English email verification form as TOTP', () => {const htmlFile = 'en-email-verification-form1.html';diff --git a/apps/browser-extension/src/utils/formDetector/__tests__/test-forms/emby-connect-login.html b/apps/browser-extension/src/utils/formDetector/__tests__/test-forms/en-login-form3.htmlsimilarity index 100%rename from apps/browser-extension/src/utils/formDetector/__tests__/test-forms/emby-connect-login.htmlrename to apps/browser-extension/src/utils/formDetector/__tests__/test-forms/en-login-form3.htmldiff --git a/apps/browser-extension/src/utils/formDetector/__tests__/test-forms/emby-connect-login-sv.html b/apps/browser-extension/src/utils/formDetector/__tests__/test-forms/en-login-form4.htmlsimilarity index 100%rename from apps/browser-extension/src/utils/formDetector/__tests__/test-forms/emby-connect-login-sv.htmlrename to apps/browser-extension/src/utils/formDetector/__tests__/test-forms/en-login-form4.htmldiff --git a/apps/browser-extension/src/utils/formDetector/__tests__/test-forms/en-totp-form10.html b/apps/browser-extension/src/utils/formDetector/__tests__/test-forms/en-totp-form10.htmlnew file mode 100644index 000000000..a4f852596--- /dev/null+++ b/apps/browser-extension/src/utils/formDetector/__tests__/test-forms/en-totp-form10.html@@ -0,0 +1,18 @@+<form action="https://dash.infinityfree.com/two-factor-challenge" method="post" autocomplete="off" id="auth-form">+ <input type="hidden" name="_token" value="odBZolu8LUcDBeJxUlHkwug6YIGJ1JhlZEqb6w8b" autocomplete="off">++ <p>+ Two factor authentication is enabled on your account. Please enter a code from your authenticator app to continue.+ </p>++ <div class="mb-3">+ <label class="form-label" for="code">+ One Time Password+ </label>+ <input type="text" class="form-control" id="code" name="code" placeholder="123456" autocomplete="off" data-av-field-type="totp" data-av-autocomplete="off">+ </div>++ <div class="form-footer">+ <button type="submit" class="btn btn-primary w-100">Log in</button>+ </div>+</form>diff --git a/apps/browser-extension/src/utils/formDetector/__tests__/test-forms/entra-id-2fa.html b/apps/browser-extension/src/utils/formDetector/__tests__/test-forms/en-totp-form11.htmlsimilarity index 100%rename from apps/browser-extension/src/utils/formDetector/__tests__/test-forms/entra-id-2fa.htmlrename to apps/browser-extension/src/utils/formDetector/__tests__/test-forms/en-totp-form11.htmldiff --git a/apps/browser-extension/src/utils/formDetector/__tests__/test-forms/en-totp-form9.html b/apps/browser-extension/src/utils/formDetector/__tests__/test-forms/en-totp-form9.htmlnew file mode 100644index 000000000..f1f040d59--- /dev/null+++ b/apps/browser-extension/src/utils/formDetector/__tests__/test-forms/en-totp-form9.html@@ -0,0 +1,79 @@+<!DOCTYPE html>+<html>+<head>+ <title>Two-Factor Authentication Setup - InfinityFree</title>+</head>+<body>+ <form method="post" action="https://dash.infinityfree.com/profile/confirmed-two-factor-authentication">+ <input type="hidden" name="_token" value="1F3W3A6oEp53bOMFigrT482O2R4CCVHH3U4u4B5q" autocomplete="off">++ <div class="card-body">+ <p>+ Scan the QR code below to set up your Two-Factor Authentication app. Most two-factor authentication apps are supported.+ </p>+ <p>+ If you don't have a two-factor authentication app yet, the free app+ <a href="https://authy.com/" target="_blank">Authy</a> is a great choice.+ </p>++ <p>+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="192" height="192" viewBox="0 0 192 192"><rect x="0" y="0" width="192" height="192" fill="#ffffff"></rect><g transform="scale(4.683)"><g transform="translate(0.000,0.000)"><path fill-rule="evenodd" d="M8 0L8 1L9 1L9 2L8 2L8 5L10 5L10 7L9 7L9 6L8 6L8 7L9 7L9 8L8 8L8 10L6 10L6 11L7 11L7 12L5 12L5 11L4 11L4 10L3 10L3 11L2 11L2 10L1 10L1 9L4 9L4 8L0 8L0 10L1 10L1 12L3 12L3 13L1 13L1 14L0 14L0 19L1 19L1 21L0 21L0 22L1 22L1 23L2 23L2 24L3 24L3 23L2 23L2 22L3 22L3 19L4 19L4 20L6 20L6 21L4 21L4 22L6 22L6 23L7 23L7 22L6 22L6 21L7 21L7 20L6 20L6 19L7 19L7 18L8 18L8 14L6 14L6 15L7 15L7 16L2 16L2 17L1 17L1 15L3 15L3 13L8 13L8 11L9 11L9 12L10 12L10 13L9 13L9 14L10 14L10 15L9 15L9 16L10 16L10 17L9 17L9 18L10 18L10 19L9 19L9 21L8 21L8 22L9 22L9 21L10 21L10 19L11 19L11 18L10 18L10 17L12 17L12 19L14 19L14 21L15 21L15 19L16 19L16 20L17 20L17 22L16 22L16 23L19 23L19 25L18 25L18 24L16 24L16 25L15 25L15 24L14 24L14 23L15 23L15 22L13 22L13 20L11 20L11 24L10 24L10 23L9 23L9 24L10 24L10 25L9 25L9 26L10 26L10 28L3 28L3 26L2 26L2 25L0 25L0 26L1 26L1 27L0 27L0 28L2 28L2 29L1 29L1 30L0 30L0 31L1 31L1 30L2 30L2 31L3 31L3 33L7 33L7 32L8 32L8 34L9 34L9 35L10 35L10 37L8 37L8 41L10 41L10 40L11 40L11 41L15 41L15 40L17 40L17 39L18 39L18 41L24 41L24 39L23 39L23 37L22 37L22 39L21 39L21 38L19 38L19 37L21 37L21 33L22 33L22 32L21 32L21 31L22 31L22 30L25 30L25 31L26 31L26 33L28 33L28 34L30 34L30 35L31 35L31 36L32 36L32 38L31 38L31 39L32 39L32 40L29 40L29 37L30 37L30 36L29 36L29 37L28 37L28 35L25 35L25 36L24 36L24 33L23 33L23 34L22 34L22 35L23 35L23 36L24 36L24 38L25 38L25 39L26 39L26 40L25 40L25 41L26 41L26 40L27 40L27 39L26 39L26 38L28 38L28 40L29 40L29 41L33 41L33 39L34 39L34 37L36 37L36 38L37 38L37 39L36 39L36 40L34 40L34 41L38 41L38 40L37 40L37 39L38 39L38 37L40 37L40 36L41 36L41 35L39 35L39 34L38 34L38 32L39 32L39 33L40 33L40 34L41 34L41 31L40 31L40 32L39 32L39 30L38 30L38 31L37 31L37 32L36 32L36 30L35 30L35 32L33 32L33 29L32 29L32 28L35 28L35 27L33 27L33 26L36 26L36 27L37 27L37 28L36 28L36 29L38 29L38 27L37 27L37 26L39 26L39 29L40 29L40 27L41 27L41 26L40 26L40 25L41 25L41 24L40 24L40 22L41 22L41 21L40 21L40 22L39 22L39 19L38 19L38 17L40 17L40 18L41 18L41 17L40 17L40 15L41 15L41 13L39 13L39 12L41 12L41 11L40 11L40 9L41 9L41 8L40 8L40 9L39 9L39 8L36 8L36 9L34 9L34 8L33 8L33 9L32 9L32 8L31 8L31 6L32 6L32 7L33 7L33 5L32 5L32 4L30 4L30 3L31 3L31 1L32 1L32 3L33 3L33 0L30 0L30 1L29 1L29 0L28 0L28 1L29 1L29 2L27 2L27 0L18 0L18 2L19 2L19 1L20 1L20 3L21 3L21 2L22 2L22 4L24 4L24 8L21 8L21 4L19 4L19 6L18 6L18 7L17 7L17 5L18 5L18 3L17 3L17 0L16 0L16 2L15 2L15 1L14 1L14 2L13 2L13 1L12 1L12 0L11 0L11 1L9 1L9 0ZM11 1L11 3L9 3L9 4L10 4L10 5L11 5L11 7L10 7L10 8L9 8L9 9L11 9L11 8L12 8L12 5L14 5L14 4L13 4L13 2L12 2L12 1ZM22 1L22 2L23 2L23 3L24 3L24 4L26 4L26 3L25 3L25 2L26 2L26 1L24 1L24 2L23 2L23 1ZM14 2L14 3L15 3L15 2ZM29 2L29 3L30 3L30 2ZM11 3L11 5L12 5L12 3ZM27 3L27 4L28 4L28 3ZM29 4L29 7L30 7L30 6L31 6L31 5L30 5L30 4ZM15 5L15 7L14 7L14 6L13 6L13 9L12 9L12 12L13 12L13 11L16 11L16 12L15 12L15 13L12 13L12 14L11 14L11 15L10 15L10 16L12 16L12 17L13 17L13 16L14 16L14 17L16 17L16 14L17 14L17 17L18 17L18 18L16 18L16 19L18 19L18 18L19 18L19 20L20 20L20 21L19 21L19 23L20 23L20 26L21 26L21 27L17 27L17 26L14 26L14 27L13 27L13 26L11 26L11 28L10 28L10 29L8 29L8 30L7 30L7 29L6 29L6 30L7 30L7 31L6 31L6 32L7 32L7 31L8 31L8 30L9 30L9 33L10 33L10 29L12 29L12 30L11 30L11 31L13 31L13 32L12 32L12 33L11 33L11 34L10 34L10 35L11 35L11 36L12 36L12 37L11 37L11 38L9 38L9 40L10 40L10 39L11 39L11 40L15 40L15 39L16 39L16 38L15 38L15 39L13 39L13 38L14 38L14 37L13 37L13 36L12 36L12 35L11 35L11 34L13 34L13 33L14 33L14 32L15 32L15 34L14 34L14 35L16 35L16 36L15 36L15 37L16 37L16 36L18 36L18 37L17 37L17 38L18 38L18 37L19 37L19 36L18 36L18 35L20 35L20 34L18 34L18 35L17 35L17 34L16 34L16 32L17 32L17 31L18 31L18 33L19 33L19 31L20 31L20 30L19 30L19 29L18 29L18 28L21 28L21 27L22 27L22 28L24 28L24 29L25 29L25 30L27 30L27 29L28 29L28 30L29 30L29 31L27 31L27 32L28 32L28 33L29 33L29 31L30 31L30 32L31 32L31 33L30 33L30 34L32 34L32 29L30 29L30 28L31 28L31 26L33 26L33 25L36 25L36 26L37 26L37 23L38 23L38 24L39 24L39 25L40 25L40 24L39 24L39 23L38 23L38 22L36 22L36 24L35 24L35 23L34 23L34 24L33 24L33 22L30 22L30 23L29 23L29 22L28 22L28 19L27 19L27 18L26 18L26 19L25 19L25 17L24 17L24 18L23 18L23 16L22 16L22 17L21 17L21 15L24 15L24 16L26 16L26 17L27 17L27 16L26 16L26 15L24 15L24 13L23 13L23 14L22 14L22 12L25 12L25 11L23 11L23 9L21 9L21 10L19 10L19 9L17 9L17 8L15 8L15 7L16 7L16 5ZM22 5L22 7L23 7L23 5ZM25 5L25 10L26 10L26 12L32 12L32 10L30 10L30 9L29 9L29 8L28 8L28 5ZM19 6L19 8L20 8L20 6ZM26 6L26 9L27 9L27 6ZM6 8L6 9L7 9L7 8ZM14 8L14 9L15 9L15 8ZM16 9L16 11L19 11L19 10L17 10L17 9ZM33 9L33 10L34 10L34 11L33 11L33 12L34 12L34 13L35 13L35 15L34 15L34 17L33 17L33 19L35 19L35 20L36 20L36 21L38 21L38 20L36 20L36 19L37 19L37 17L38 17L38 16L39 16L39 13L38 13L38 12L39 12L39 11L38 11L38 10L39 10L39 9L37 9L37 13L36 13L36 12L34 12L34 11L36 11L36 10L34 10L34 9ZM9 10L9 11L10 11L10 12L11 12L11 10ZM28 10L28 11L29 11L29 10ZM17 12L17 14L18 14L18 15L21 15L21 12L20 12L20 13L19 13L19 14L18 14L18 12ZM15 13L15 14L16 14L16 13ZM25 13L25 14L27 14L27 15L28 15L28 18L29 18L29 19L31 19L31 21L32 21L32 16L33 16L33 15L32 15L32 16L31 16L31 17L30 17L30 15L29 15L29 14L30 14L30 13L29 13L29 14L27 14L27 13ZM32 13L32 14L33 14L33 13ZM37 13L37 15L36 15L36 16L35 16L35 17L37 17L37 16L38 16L38 13ZM4 14L4 15L5 15L5 14ZM12 15L12 16L13 16L13 15ZM14 15L14 16L15 16L15 15ZM18 16L18 17L19 17L19 16ZM2 17L2 18L7 18L7 17ZM20 17L20 20L21 20L21 21L20 21L20 23L21 23L21 22L22 22L22 24L23 24L23 25L21 25L21 26L22 26L22 27L23 27L23 25L24 25L24 24L25 24L25 25L26 25L26 26L25 26L25 27L26 27L26 28L25 28L25 29L26 29L26 28L27 28L27 26L28 26L28 27L29 27L29 25L30 25L30 26L31 26L31 25L30 25L30 24L31 24L31 23L30 23L30 24L29 24L29 25L27 25L27 24L28 24L28 23L27 23L27 22L26 22L26 21L27 21L27 19L26 19L26 21L25 21L25 22L26 22L26 23L24 23L24 21L23 21L23 22L22 22L22 20L21 20L21 19L23 19L23 20L24 20L24 19L23 19L23 18L21 18L21 17ZM29 17L29 18L30 18L30 17ZM14 18L14 19L15 19L15 18ZM35 18L35 19L36 19L36 18ZM40 19L40 20L41 20L41 19ZM29 20L29 21L30 21L30 20ZM34 21L34 22L35 22L35 21ZM12 23L12 24L11 24L11 25L13 25L13 23ZM23 23L23 24L24 24L24 23ZM4 24L4 25L5 25L5 27L7 27L7 26L8 26L8 24ZM6 25L6 26L7 26L7 25ZM12 27L12 29L13 29L13 30L14 30L14 31L15 31L15 32L16 32L16 31L17 31L17 27L14 27L14 28L13 28L13 27ZM14 28L14 30L15 30L15 29L16 29L16 28ZM2 29L2 30L3 30L3 29ZM4 29L4 31L5 31L5 29ZM21 29L21 30L22 30L22 29ZM23 31L23 32L24 32L24 31ZM1 32L1 33L2 33L2 32ZM20 32L20 33L21 33L21 32ZM33 33L33 36L36 36L36 33ZM34 34L34 35L35 35L35 34ZM37 34L37 37L38 37L38 36L39 36L39 35L38 35L38 34ZM26 36L26 37L25 37L25 38L26 38L26 37L27 37L27 36ZM32 38L32 39L33 39L33 38ZM19 39L19 40L20 40L20 39ZM39 39L39 41L40 41L40 39ZM0 0L0 7L7 7L7 0ZM1 1L1 6L6 6L6 1ZM2 2L2 5L5 5L5 2ZM41 0L34 0L34 7L41 7ZM40 1L35 1L35 6L40 6ZM39 2L36 2L36 5L39 5ZM0 41L7 41L7 34L0 34ZM1 40L6 40L6 35L1 35ZM2 39L5 39L5 36L2 36Z" fill="#2d3748"></path></g></g></svg>+ </p>++ <p>+ Can't scan the QR code? You can also enter the code: <code>HZA4ZELL6L34PD7J</code>.+ </p>++ <p>+ Generate a one time code and enter it below to finish the setup.+ </p>++ <div class="mb-3">+ <label for="code" class="form-label">Authentication Code</label>+ <input type="text" id="code" name="code" placeholder="123456" class="form-control " autocomplete="off" data-av-autocomplete="off">+ </div>++ <div class="alert alert-warning" role="alert">+ <div class="alert-icon">+ <svg class="icon alert-icon icon-2" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>+ <path d="M12 9v4"></path>+ <path d="M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0"></path>+ <path d="M12 16h.01"></path>+ </svg>+ </div>+ <div>+ <h4 class="alert-heading">Warning: You are responsible for making sure you backup your authenticator app and recovery codes.</h4>+ <div class="alert-description">+ If you lose both, you will lose access to your account!+ </div>+ </div>+ </div>+ </div>++ <div class="card-footer d-flex align-items-center">+ <a href="https://dash.infinityfree.com/profile/two-factor-authentication" class="btn btn-default">+ <svg class="icon icon-tabler" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>+ <path d="M5 12l14 0"></path>+ <path d="M5 12l6 6"></path>+ <path d="M5 12l6 -6"></path>+ </svg>+ Back+ </a>++ <div class="m-0 ms-auto">+ <button type="submit" class="btn btn-primary">+ <svg class="icon icon-tabler" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>+ <path d="M12 3a12 12 0 0 0 8.5 3a12 12 0 0 1 -8.5 15a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3"></path>+ <path d="M11 11a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path>+ <path d="M12 12l0 2.5"></path>+ </svg>+ Enable Two-factor Authentication+ </button>+ </div>+ </div>+ </form>+</body>+</html>