From 0c54901499166d69986406689826e94c8e17614d Mon Sep 17 00:00:00 2001 From: varjolintu Date: Wed, 24 Apr 2019 21:13:12 +0300 Subject: [PATCH] Add username type as accepted input type --- keepassxc-browser/content/keepassxc-browser.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js index a196ada..37f22b3 100755 --- a/keepassxc-browser/content/keepassxc-browser.js +++ b/keepassxc-browser/content/keepassxc-browser.js @@ -149,7 +149,7 @@ kpxcForm.onSubmit = function() { var kpxcFields = {}; -kpxcFields.inputQueryPattern = 'input[type=\'text\'], input[type=\'email\'], input[type=\'password\'], input[type=\'tel\'], input[type=\'number\'], input:not([type])'; +kpxcFields.inputQueryPattern = 'input[type=\'text\'], input[type=\'email\'], input[type=\'password\'], input[type=\'tel\'], input[type=\'number\'], input[type=\'username\'], input:not([type])'; // copied from Sizzle.js kpxcFields.rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g; @@ -359,7 +359,7 @@ kpxcFields.getCombination = function(givenType, fieldId) { if (givenType === 'username') { const passwordField = kpxcFields.getPasswordField(fieldId, true); let passwordId = null; - if (passwordField && passwordField.value.length > 0) { + if (passwordField) { passwordId = kpxcFields.prepareId(passwordField.getAttribute('data-kpxc-id')); } combination = { @@ -370,7 +370,7 @@ kpxcFields.getCombination = function(givenType, fieldId) { } else if (givenType === 'password') { const usernameField = kpxcFields.getUsernameField(fieldId, true); let usernameId = null; - if (usernameField && usernameField.value.length > 0) { + if (usernameField) { usernameId = kpxcFields.prepareId(usernameField.getAttribute('data-kpxc-id')); } combination = { @@ -572,6 +572,7 @@ kpxcObserverHelper.inputTypes = [ 'password', 'tel', 'number', + 'username', // Note: Not a standard null // Input field can be without any type. Include these to the list. ];