Merge pull request #577 from keepassxreboot/fix/password_fill

Fix password fill
This commit is contained in:
Sami Vänttinen 2019-07-10 08:03:15 +03:00 committed by GitHub
commit 4761bd68fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 11 deletions

View file

@ -88,12 +88,12 @@ browser.runtime.onMessage.addListener(function(req, sender) {
});
function _f(fieldId) {
const inputs = document.querySelectorAll('input[data-kpxc-id=\'' + fieldId + '\']');
const inputs = document.querySelectorAll(`input[data-kpxc-id='${fieldId}']`);
return inputs.length > 0 ? inputs[0] : null;
}
function _fs(fieldId) {
const inputs = document.querySelectorAll('input[data-kpxc-id=\'' + fieldId + '\'], select[data-kpxc-id=\'' + fieldId + '\']');
const inputs = document.querySelectorAll(`input[data-kpxc-id='${fieldId}'], select[data-kpxc-id='${fieldId}']`);
return inputs.length > 0 ? inputs[0] : null;
}

View file

@ -267,15 +267,8 @@ kpxcPassword.copy = function(e) {
kpxcPassword.fill = function(e) {
e.preventDefault();
let field = null;
const inputs = document.querySelectorAll('input[type=\'password\']');
for (const i of inputs) {
if (i.getAttribute('data-kpxc-id')) {
field = i;
break;
}
}
// Use the active input field
const field = _f(kpxcPassword.dialog.getAttribute('kpxc-pwgen-field-id'));
if (field) {
const password = $('.kpxc-pwgen-input');
if (field.getAttribute('maxlength')) {