From 4982cfc9cfc0aa8e405e15a68f53af3939223ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20V=C3=A4nttinen?= Date: Wed, 24 Aug 2022 22:25:14 +0300 Subject: Fix PayPal TOTP --- keepassxc-browser/content/fields.js | 22 +++++++++++++++++++++- keepassxc-browser/manifest.json | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/keepassxc-browser/content/fields.js b/keepassxc-browser/content/fields.js index a2db5a5..2170c2e 100644 --- a/keepassxc-browser/content/fields.js +++ b/keepassxc-browser/content/fields.js @@ -115,11 +115,31 @@ kpxcFields.getSegmentedTOTPFields = function(inputs, combinations) { } }; + const formLengthMatches = function(currentForm) { + if (!currentForm) { + return false; + } + + // Accept 6 inputs directly + if (currentForm.length === 6) { + return true; + } + + // 7 inputs with a button as the last one (e.g. PayPal uses this) + if (currentForm.length === 7 + && (currentForm.lastChild.nodeName === 'BUTTON' + || (currentForm.lastChild.nodeName === 'INPUT' && currentForm.lastChild.type === 'button'))) { + return true; + } + + return false; + }; + const form = inputs.length > 0 ? inputs[0].form : undefined; if (form && (acceptedOTPFields.some(f => (form.className && form.className.includes(f)) || (form.id && typeof(form.id) === 'string' && form.id.includes(f)) || (form.name && typeof(form.name) === 'string' && form.name.includes(f)) - || form.length === 6))) { + || formLengthMatches(form)))) { // Use the form's elements addTotpFieldsToCombination(form.elements); } else if (inputs.length === 6 && inputs.every(i => (i.inputMode === 'numeric' && i.pattern.includes('0-9')) diff --git a/keepassxc-browser/manifest.json b/keepassxc-browser/manifest.json index b5c18e6..341ba81 100755 --- a/keepassxc-browser/manifest.json +++ b/keepassxc-browser/manifest.json @@ -1,8 +1,8 @@ { "manifest_version": 2, "name": "KeePassXC-Browser", - "version": "1.8.1", - "version_name": "1.8.1", + "version": "1.8.2", + "version_name": "1.8.2", "description": "__MSG_extensionDescription__", "author": "KeePassXC Team", "icons": { diff --git a/package-lock.json b/package-lock.json index 84ea8d8..1095d47 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "KeePassXC-Browser", - "version": "1.8.1", + "version": "1.8.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "KeePassXC-Browser", - "version": "1.8.1", + "version": "1.8.2", "license": "GPL-3.0", "dependencies": { "@npmcli/fs": "^2.1.0", diff --git a/package.json b/package.json index ec1fa7c..c2d2492 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "KeePassXC-Browser", - "version": "1.8.1", + "version": "1.8.2", "description": "KeePassXC-Browser", "main": "build.js", "devDependencies": { -- cgit v1.2.3