mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Compare commits
No commits in common. "b01af22fd1cc27669eb472f314b83552efcf8d07" and "bf0969aefefe045d202a2e14b5f7fb799a1bc3d3" have entirely different histories.
b01af22fd1
...
bf0969aefe
3 changed files with 7 additions and 25 deletions
|
|
@ -104,9 +104,8 @@ kpxcFields.getExistingCombination = function(combination) {
|
|||
existingCombination.password ??= combination.password;
|
||||
if (existingCombination.passwordInputs?.length === 0) {
|
||||
existingCombination.passwordInputs = combination.passwordInputs;
|
||||
} else if (combination?.password) {
|
||||
// If password field is found in the current combination, force assign it to the existing combination
|
||||
existingCombination.password = combination.password;
|
||||
} else {
|
||||
existingCombination.passwordInputs.push(combination.password);
|
||||
}
|
||||
|
||||
// Remove username field from combination with certain sites (replaced by password input)
|
||||
|
|
@ -647,11 +646,6 @@ kpxcFields.useCustomLoginFields = async function() {
|
|||
kpxcTOTPIcons.newIcon(totp, kpxc.databaseState);
|
||||
}
|
||||
|
||||
// No values found
|
||||
if (!username && !password && !totp && !submitButton && stringFields?.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const combinations = [];
|
||||
combinations.push({
|
||||
username: username,
|
||||
|
|
|
|||
|
|
@ -66,9 +66,6 @@ kpxcForm.getFormSubmitButton = function(form) {
|
|||
return;
|
||||
}
|
||||
|
||||
const hasPasswordClassOrId = (button) => button
|
||||
&& (button?.classList.value?.toLowerCase()?.includes('password')
|
||||
|| button?.id?.toLowerCase()?.includes('password'));
|
||||
const action = kpxc.submitUrl || form.action;
|
||||
|
||||
// Check if the site needs a special handling for retrieving the form submit button
|
||||
|
|
@ -91,19 +88,13 @@ kpxcForm.getFormSubmitButton = function(form) {
|
|||
b => !b.getAttribute('formAction')
|
||||
);
|
||||
if (buttons.length > 0) {
|
||||
const lastButton = buttons.at(-1);
|
||||
// Accept button if it has no indication for password
|
||||
if (!hasPasswordClassOrId(lastButton)) {
|
||||
return buttons.at(-1);
|
||||
}
|
||||
return buttons.at(-1);
|
||||
}
|
||||
|
||||
// Try to find similar buttons outside the form which are added via 'form' property
|
||||
for (const e of form.elements) {
|
||||
const isSubmitButton = matchesWithNodeName(e, 'BUTTON')
|
||||
&& (e.type === 'button' || e.type === 'submit' || e.type === '');
|
||||
const isInputButton = matchesWithNodeName(e, 'INPUT') && (e.type === 'button' || e.type === 'submit');
|
||||
if ((isSubmitButton || isInputButton) && !hasPasswordClassOrId(e)) {
|
||||
if ((matchesWithNodeName(e, 'BUTTON') && (e.type === 'button' || e.type === 'submit' || e.type === ''))
|
||||
|| (matchesWithNodeName(e, 'INPUT') && (e.type === 'button' || e.type === 'submit'))) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ kpxc.initCredentialFields = async function() {
|
|||
|
||||
// Search all remaining inputs from the page, ignore the previous input fields
|
||||
const pageInputs = await kpxcFields.getAllPageInputs(formInputs);
|
||||
if (formInputs.length === 0 && pageInputs.length === 0) {
|
||||
if (formInputs.length === 0 && pageInputs.length === 0 && !kpxcFields.isCustomLoginFieldsUsed()) {
|
||||
// Run 'redetect_credentials' manually if no fields are found after a page load
|
||||
setTimeout(async function() {
|
||||
if (_called.automaticRedetectCompleted) {
|
||||
|
|
@ -653,10 +653,7 @@ kpxc.retrieveCredentials = async function(force = false) {
|
|||
}
|
||||
|
||||
kpxc.url = document.location.href;
|
||||
|
||||
// Search for first combination that has username or password input set
|
||||
const firstCombination = kpxc.combinations?.find((combination) => combination?.username || combination?.password);
|
||||
kpxc.submitUrl = kpxc.getFormActionUrl(firstCombination);
|
||||
kpxc.submitUrl = kpxc.getFormActionUrl(kpxc.combinations[0]);
|
||||
|
||||
if (kpxc.settings.autoRetrieveCredentials && kpxc.url && kpxc.submitUrl) {
|
||||
await kpxc.retrieveCredentialsCallback(
|
||||
|
|
|
|||
Loading…
Reference in a new issue