mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #2682 from keepassxreboot/fix/detect_existing_combination
Fix detecting existing combination
This commit is contained in:
parent
8042b71735
commit
5468c2058d
2 changed files with 24 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue