From 474623ef6471d3e8e96ae6a19148484c34fdd3cc Mon Sep 17 00:00:00 2001 From: varjolintu Date: Tue, 21 Feb 2023 15:09:16 +0200 Subject: [PATCH] Allow force-fill to String Fields even if readonly --- keepassxc-browser/content/fill.js | 2 +- keepassxc-browser/content/keepassxc-browser.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/keepassxc-browser/content/fill.js b/keepassxc-browser/content/fill.js index 50fc4a3..5353a7c 100644 --- a/keepassxc-browser/content/fill.js +++ b/keepassxc-browser/content/fill.js @@ -288,7 +288,7 @@ kpxcFill.fillInStringFields = function(fields, stringFields) { const currentField = fields[i]; if (currentField && stringFieldValue[0]) { - kpxc.setValue(currentField, stringFieldValue[0]); + kpxc.setValue(currentField, stringFieldValue[0], true); filledInFields.push(currentField); } } diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js index 8cf9701..9412d10 100755 --- a/keepassxc-browser/content/keepassxc-browser.js +++ b/keepassxc-browser/content/keepassxc-browser.js @@ -643,7 +643,7 @@ kpxc.setPasswordFilled = async function(state) { }; // Special handling for settings value to select element -kpxc.setValue = function(field, value) { +kpxc.setValue = function(field, value, forced = false) { if (field.matches('select')) { value = value.toLowerCase().trim(); const options = field.querySelectorAll('option'); @@ -658,12 +658,12 @@ kpxc.setValue = function(field, value) { return; } - kpxc.setValueWithChange(field, value); + kpxc.setValueWithChange(field, value, forced); }; // Sets a new value to input field and triggers necessary events -kpxc.setValueWithChange = function(field, value) { - if (field.readOnly) { +kpxc.setValueWithChange = function(field, value, forced = false) { + if (!forced && field.readOnly) { return; }