mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Do not add helpers on fields that have autocomplete="off" or autocomplete="new-password". Identify fields with autocomplete="one-time-code" as TOTP fields.
This commit is contained in:
parent
059d0ccf50
commit
2cffdfa9d7
1 changed files with 8 additions and 2 deletions
|
|
@ -300,11 +300,16 @@ kpxcFields.isVisible = function(field) {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
kpxcFields.isAutocompleteAppropriate = function(field) {
|
||||||
|
const autocomplete = field.getLowerCaseAttribute('autocomplete');
|
||||||
|
return !(autocomplete === 'off' || autocomplete === 'new-password');
|
||||||
|
};
|
||||||
|
|
||||||
kpxcFields.getAllFields = function() {
|
kpxcFields.getAllFields = function() {
|
||||||
const fields = [];
|
const fields = [];
|
||||||
const inputs = kpxcObserverHelper.getInputs(document);
|
const inputs = kpxcObserverHelper.getInputs(document);
|
||||||
for (const i of inputs) {
|
for (const i of inputs) {
|
||||||
if (kpxcFields.isVisible(i) && !kpxcFields.isSearchField(i)) {
|
if (kpxcFields.isVisible(i) && !kpxcFields.isSearchField(i) && kpxcFields.isAutocompleteAppropriate(i)) {
|
||||||
kpxcFields.setUniqueId(i);
|
kpxcFields.setUniqueId(i);
|
||||||
fields.push(i);
|
fields.push(i);
|
||||||
}
|
}
|
||||||
|
|
@ -992,8 +997,9 @@ kpxc.initOTPFields = function(inputs, databaseClosed) {
|
||||||
for (const i of inputs) {
|
for (const i of inputs) {
|
||||||
const id = i.getLowerCaseAttribute('id');
|
const id = i.getLowerCaseAttribute('id');
|
||||||
const name = i.getLowerCaseAttribute('name');
|
const name = i.getLowerCaseAttribute('name');
|
||||||
|
const autocomplete = i.getLowerCaseAttribute('autocomplete');
|
||||||
|
|
||||||
if (acceptedOTPFields.some(f => (id && id.includes(f)) || (name && name.includes(f)))) {
|
if (autocomplete === 'one-time-code' || acceptedOTPFields.some(f => (id && id.includes(f)) || (name && name.includes(f)))) {
|
||||||
kpxcTOTPIcons.newIcon(i, _databaseClosed);
|
kpxcTOTPIcons.newIcon(i, _databaseClosed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue