diff options
author | Stefan Sundin <git@stefansundin.com> | 2019-12-24 08:36:22 +0300 |
---|---|---|
committer | Stefan Sundin <git@stefansundin.com> | 2020-02-10 04:31:07 +0300 |
commit | 2cffdfa9d70f604b1b53a892def8f3b4a6bedf2f (patch) | |
tree | 4d1b501bfdbe05870ad11d005205bbc256b531d9 /keepassxc-browser/content | |
parent | 059d0ccf50f6aa5431f8e15ebb9e64a10484cabc (diff) |
Do not add helpers on fields that have autocomplete="off" or autocomplete="new-password". Identify fields with autocomplete="one-time-code" as TOTP fields.
Diffstat (limited to 'keepassxc-browser/content')
-rwxr-xr-x | keepassxc-browser/content/keepassxc-browser.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js index e064e27..326bed6 100755 --- a/keepassxc-browser/content/keepassxc-browser.js +++ b/keepassxc-browser/content/keepassxc-browser.js @@ -300,11 +300,16 @@ kpxcFields.isVisible = function(field) { return true; }; +kpxcFields.isAutocompleteAppropriate = function(field) { + const autocomplete = field.getLowerCaseAttribute('autocomplete'); + return !(autocomplete === 'off' || autocomplete === 'new-password'); +}; + kpxcFields.getAllFields = function() { const fields = []; const inputs = kpxcObserverHelper.getInputs(document); 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); fields.push(i); } @@ -992,8 +997,9 @@ kpxc.initOTPFields = function(inputs, databaseClosed) { for (const i of inputs) { const id = i.getLowerCaseAttribute('id'); 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); } } |