Merge pull request #1704 from keepassxreboot/fix/paypal_totp

Fix PayPal TOTP
This commit is contained in:
Sami Vänttinen 2022-08-25 14:51:07 +03:00 committed by GitHub
commit 411e9194a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 6 deletions

View file

@ -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'))

View file

@ -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": {

4
package-lock.json generated
View file

@ -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",

View file

@ -1,6 +1,6 @@
{
"name": "KeePassXC-Browser",
"version": "1.8.1",
"version": "1.8.2",
"description": "KeePassXC-Browser",
"main": "build.js",
"devDependencies": {