Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc-browser.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarjolintu <sami.vanttinen@protonmail.com>2022-04-05 15:36:51 +0300
committervarjolintu <sami.vanttinen@protonmail.com>2022-04-05 15:36:51 +0300
commit278b83980ff7b89cf3f387e8f7718f868804cdd5 (patch)
treeb3dd589c1897b249658dcd9836dabd7763b140ee
parentcf77eb8daead067fe9ca29c248b0334cd86728cd (diff)
-rw-r--r--keepassxc-browser/content/fill.js9
-rwxr-xr-xkeepassxc-browser/content/keepassxc-browser.js12
2 files changed, 11 insertions, 10 deletions
diff --git a/keepassxc-browser/content/fill.js b/keepassxc-browser/content/fill.js
index eb1a123..c39e97d 100644
--- a/keepassxc-browser/content/fill.js
+++ b/keepassxc-browser/content/fill.js
@@ -23,6 +23,7 @@ kpxcFill.fillAttributeToActiveElementWith = async function(attr) {
// Fill requested from the context menu. Active element is used for combination detection
kpxcFill.fillInFromActiveElement = async function(passOnly = false) {
+ await kpxc.receiveCredentialsIfNecessary();
if (kpxc.credentials.length === 0) {
logDebug('Error: Credential list is empty.');
return;
@@ -37,13 +38,7 @@ kpxcFill.fillInFromActiveElement = async function(passOnly = false) {
// No previous combinations detected. Create a new one from active element
const el = document.activeElement;
- const combination = await kpxc.createCombination(el);
-
- // Do not allow filling password to a non-password field
- if (passOnly && combination && !combination.password) {
- kpxcUI.createNotification('warning', tr('fieldsNoPasswordField'));
- return;
- }
+ const combination = await kpxc.createCombination(el, passOnly);
await sendMessage('page_set_login_id', kpxc.credentials[0].uuid);
kpxcFill.fillInCredentials(combination, kpxc.credentials[0].login, kpxc.credentials[0].uuid, passOnly);
diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js
index ef6ea1d..2679934 100755
--- a/keepassxc-browser/content/keepassxc-browser.js
+++ b/keepassxc-browser/content/keepassxc-browser.js
@@ -72,15 +72,21 @@ kpxc.clearAllFromPage = function() {
};
// Creates a new combination manually from active element
-kpxc.createCombination = async function(activeElement) {
+kpxc.createCombination = async function(activeElement, passOnly) {
const combination = {
username: null,
password: null,
passwordInputs: [],
- form: activeElement.form
+ form: null
};
- if (activeElement.getLowerCaseAttribute('type') === 'password') {
+ if (!activeElement) {
+ return combination;
+ }
+
+ combination.form = activeElement.form;
+
+ if (passOnly || activeElement.getLowerCaseAttribute('type') === 'password') {
combination.password = activeElement;
} else {
combination.username = activeElement;