diff --git a/keepassxc-browser/content/totp-field.js b/keepassxc-browser/content/totp-field.js index d4e9a07..a12032b 100644 --- a/keepassxc-browser/content/totp-field.js +++ b/keepassxc-browser/content/totp-field.js @@ -1,6 +1,6 @@ 'use strict'; -const ignoreRegex = /(bank|coupon|postal|user|zip).*code|comment|author|error/i; +const ignoreRegex = /(bank|coupon|postal|user|zip).*code|(en|de)code(d|r)*|comment|author|error/i; const ignoredTypes = [ 'email', 'password', 'username' ]; const acceptedOTPFields = [ diff --git a/tests/tests.js b/tests/tests.js index 931d336..4e4a2f4 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -60,6 +60,10 @@ async function testTotpFields() { [ '', { id: '2fa', type: 'text', maxLength: '6' }, 'Generic 2FA field', true ], [ '', { id: '2fa', type: 'text', maxLength: '4' }, 'Ignore if field maxLength too small', false ], [ '', { id: '2fa', type: 'text', maxLength: '12' }, 'Ignore if field maxLength too long', false ], + [ '', { id: 'encode', type: 'text', }, 'encode id is not acceptable', false ], + [ '', { id: 'encodedText', type: 'text', }, 'encodedText is not acceptable', false ], + [ '', { id: 'decoder', type: 'text', }, 'decoder id is not acceptable', false ], + [ '', { id: 'code', type: 'text', }, 'code id is accepted', true ], [ '', { id: '2fa', type: 'text', maxLength: '12', autocomplete: 'one-time-code' }, 'Accept if one-time-code', true ], [ '', { id: 'username', type: 'text', }, 'Ignore a generic input field', false ], [ '', { type: 'password', }, 'Ignore a password input field', false ],