mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #2454 from keepassxreboot/fix/totp_allowed_inputtypes
Add extra check for TOTP field input type
This commit is contained in:
commit
688dee35e9
1 changed files with 7 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
const ignoreRegex = /(bank|coupon|postal|user|zip).*code|(en|de)code(d|r)*|comment|author|error/i;
|
||||
const ignoredTypes = [ 'email', 'password', 'username' ];
|
||||
const allowedInputTypes = [ 'number', 'password', 'tel', 'text' ];
|
||||
|
||||
const acceptedOTPFields = [
|
||||
'2fa',
|
||||
|
|
@ -52,6 +53,12 @@ kpxcTOTPIcons.isAcceptedTOTPField = function(field) {
|
|||
const id = field.getLowerCaseAttribute('id');
|
||||
const name = field.getLowerCaseAttribute('name');
|
||||
const placeholder = field.getLowerCaseAttribute('placeholder');
|
||||
const type = field.getLowerCaseAttribute('type');
|
||||
|
||||
// Checks if input type is allowed
|
||||
if (!allowedInputTypes.some(t => type === t)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Checks if the field id, name or placeholder includes some of the acceptedOTPFields but not any from ignoredTypes
|
||||
if ((acceptedOTPFields.some(f => id?.includes(f) || (name?.includes(f) || placeholder?.includes(f))) || acceptedParents.some(s => field.closest(s)))
|
||||
|
|
|
|||
Loading…
Reference in a new issue