From 5468c2058dc21c90c594ead4aabe3f559e2f5940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20V=C3=A4nttinen?= Date: Wed, 10 Sep 2025 21:26:59 +0300 Subject: [PATCH] Merge pull request #2682 from keepassxreboot/fix/detect_existing_combination Fix detecting existing combination --- keepassxc-browser/common/sites.js | 3 +++ keepassxc-browser/content/fields.js | 22 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/keepassxc-browser/common/sites.js b/keepassxc-browser/common/sites.js index ee159d0..3267523 100644 --- a/keepassxc-browser/common/sites.js +++ b/keepassxc-browser/common/sites.js @@ -100,6 +100,9 @@ kpxcSites.exceptionFound = function(identifier, field) { } else if (document.location.origin === 'https://id.atlassian.com' && Array.isArray(identifier) && identifier?.contains('password-field')) { return true; + } else if (document.location.origin === 'https://app.fastmail.com' + && identifier?.contains('u-space-y-5') && field?.id === 'v25') { + return true; } return false; diff --git a/keepassxc-browser/content/fields.js b/keepassxc-browser/content/fields.js index 731d604..8920a1a 100644 --- a/keepassxc-browser/content/fields.js +++ b/keepassxc-browser/content/fields.js @@ -29,7 +29,7 @@ kpxcFields.getAllCombinations = async function(inputs) { form: input.form }; - combinations.push(combination); + combinations.push(kpxcFields.getExistingCombination(combination)); usernameField = null; } else if (kpxcTOTPIcons.isValid(input)) { // Dynamically added TOTP field @@ -93,6 +93,26 @@ kpxcFields.getCombinationFromAllInputs = function() { return kpxc.combinations[0]; }; +// Checks if existing combination is found and recognized fields are added to it +kpxcFields.getExistingCombination = function(combination) { + // Lookup existing combinations that use the same form + const existingCombination = kpxc.combinations?.find(c => c.form === combination?.form); + if (existingCombination) { + // Replace values to the existing combination + existingCombination.username ??= combination.username; + existingCombination.password ??= combination.password; + if (existingCombination.passwordInputs?.length === 0) { + existingCombination.passwordInputs = combination.passwordInputs; + } else { + existingCombination.passwordInputs.push(combination.password); + } + + return existingCombination; + } + + return combination; +}; + // Adds segmented TOTP fields to the combination if found kpxcFields.getSegmentedTOTPFields = function(inputs, combinations) { if (!kpxc.settings.showOTPIcon) {