Merge pull request #1857 from keepassxreboot/fix/allow_fill_to_string_fields

Allow force-fill to String Fields even if readonly
This commit is contained in:
Sami Vänttinen 2023-02-25 14:43:11 +02:00 committed by GitHub
commit e9140247a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -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);
}
}

View file

@ -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;
}