mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #1731 from keepassxreboot/fix/clf_string_fields
Fix saving Custom Login Fields
This commit is contained in:
commit
a13a34ee78
1 changed files with 30 additions and 30 deletions
|
|
@ -323,39 +323,41 @@ kpxcCustomLoginFieldsBanner.confirm = async function() {
|
|||
const location = kpxc.getDocumentLocation();
|
||||
const currentSettings = kpxc.settings[DEFINED_CUSTOM_FIELDS][location];
|
||||
|
||||
if (currentSettings) {
|
||||
// Update the single selection to current settings
|
||||
if (usernamePath) {
|
||||
clearIdenticalField(usernamePath, location);
|
||||
kpxc.settings[DEFINED_CUSTOM_FIELDS][location].username = usernamePath;
|
||||
if (usernamePath || passwordPath || totpPath || stringFieldsPaths.length > 0) {
|
||||
if (currentSettings) {
|
||||
// Update the single selection to current settings
|
||||
if (usernamePath) {
|
||||
clearIdenticalField(usernamePath, location);
|
||||
kpxc.settings[DEFINED_CUSTOM_FIELDS][location].username = usernamePath;
|
||||
}
|
||||
|
||||
if (passwordPath) {
|
||||
clearIdenticalField(passwordPath, location);
|
||||
kpxc.settings[DEFINED_CUSTOM_FIELDS][location].password = passwordPath;
|
||||
}
|
||||
|
||||
if (totpPath) {
|
||||
clearIdenticalField(totpPath, location);
|
||||
kpxc.settings[DEFINED_CUSTOM_FIELDS][location].totp = totpPath;
|
||||
}
|
||||
|
||||
if (stringFieldsPaths.length > 0) {
|
||||
kpxc.settings[DEFINED_CUSTOM_FIELDS][location].fields = stringFieldsPaths;
|
||||
}
|
||||
} else {
|
||||
// Override all fields (default, because there's no currentSettings available)
|
||||
kpxc.settings[DEFINED_CUSTOM_FIELDS][location] = {
|
||||
username: usernamePath,
|
||||
password: passwordPath,
|
||||
totp: totpPath,
|
||||
fields: stringFieldsPaths
|
||||
};
|
||||
}
|
||||
|
||||
if (passwordPath) {
|
||||
clearIdenticalField(passwordPath, location);
|
||||
kpxc.settings[DEFINED_CUSTOM_FIELDS][location].password = passwordPath;
|
||||
}
|
||||
|
||||
if (totpPath) {
|
||||
clearIdenticalField(totpPath, location);
|
||||
kpxc.settings[DEFINED_CUSTOM_FIELDS][location].totp = totpPath;
|
||||
}
|
||||
|
||||
if (stringFieldsPaths.length > 0) {
|
||||
kpxc.settings[DEFINED_CUSTOM_FIELDS][location].fields = stringFieldsPaths;
|
||||
}
|
||||
} else {
|
||||
// Override all fields (default)
|
||||
kpxc.settings[DEFINED_CUSTOM_FIELDS][location] = {
|
||||
username: usernamePath,
|
||||
password: passwordPath,
|
||||
totp: totpPath,
|
||||
fields: stringFieldsPaths
|
||||
};
|
||||
await sendMessage('save_settings', kpxc.settings);
|
||||
}
|
||||
|
||||
await sendMessage('save_settings', kpxc.settings);
|
||||
kpxcCustomLoginFieldsBanner.destroy();
|
||||
|
||||
sendMessageToFrames('confirm_button_clicked');
|
||||
};
|
||||
|
||||
|
|
@ -511,7 +513,6 @@ kpxcCustomLoginFieldsBanner.selectStringFields = function() {
|
|||
};
|
||||
|
||||
kpxcCustomLoginFieldsBanner.markFields = function() {
|
||||
let index = 1;
|
||||
let firstInput;
|
||||
const inputs = document.querySelectorAll(kpxcCustomLoginFieldsBanner.inputQueryPattern);
|
||||
|
||||
|
|
@ -567,7 +568,6 @@ kpxcCustomLoginFieldsBanner.markFields = function() {
|
|||
|
||||
kpxcCustomLoginFieldsBanner.chooser.append(field);
|
||||
firstInput = field;
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue