Merge pull request #1304 from keepassxreboot/fix/switch_from_index_to_uuid

Switch from index to uuid
This commit is contained in:
Sami Vänttinen 2021-04-12 16:27:05 +03:00 committed by GitHub
commit dc3e680d1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 18 deletions

View file

@ -38,7 +38,7 @@ CredentialAutocomplete.prototype.fillPassword = async function(value, index, uui
const combination = await kpxcFields.getCombination(this.input);
combination.loginId = index;
await sendMessage('page_set_login_id', index);
await sendMessage('page_set_login_id', uuid);
const manualFill = await sendMessage('page_get_manual_fill');
await kpxc.fillInCredentials(combination, value, uuid, manualFill === ManualFill.PASSWORD);

View file

@ -920,7 +920,7 @@ kpxc.fillInFromActiveElement = async function(passOnly = false) {
return;
}
await sendMessage('page_set_login_id', 0);
await sendMessage('page_set_login_id', '');
kpxc.fillInCredentials(combination, kpxc.credentials[0].login, kpxc.credentials[0].uuid, passOnly);
};
@ -931,7 +931,7 @@ kpxc.fillFromAutofill = async function() {
}
const index = kpxc.combinations.length - 1;
await sendMessage('page_set_login_id', 0);
await sendMessage('page_set_login_id', '');
kpxc.fillInCredentials(kpxc.combinations[index], kpxc.credentials[0].login, kpxc.credentials[0].uuid);
// Generate popup-list of usernames + descriptions
@ -944,7 +944,7 @@ kpxc.fillFromPopup = async function(id, uuid) {
return;
}
await sendMessage('page_set_login_id', id);
await sendMessage('page_set_login_id', uuid);
const selectedCredentials = kpxc.credentials.find(c => c.uuid === uuid);
if (!selectedCredentials) {
console.log('Error: Uuid not found: ', uuid);
@ -1041,7 +1041,7 @@ kpxc.fillFromUsernameIcon = async function(combination) {
return;
}
await sendMessage('page_set_login_id', 0);
await sendMessage('page_set_login_id', '');
kpxc.fillInCredentials(combination, kpxc.credentials[0].login, kpxc.credentials[0].uuid);
};
@ -1508,9 +1508,12 @@ kpxc.rememberCredentials = async function(usernameValue, passwordValue, urlValue
if (credentialsList.length === 1) {
usernameValue = credentialsList[0].login;
} else if (credentialsList.length > 1) {
const index = await sendMessage('page_get_login_id');
if (index >= 0) {
usernameValue = credentialsList[index].login;
const uuid = await sendMessage('page_get_login_id');
if (uuid) {
const credsFromUuid = credentialsList.find(c => c.uuid === uuid);
if (credsFromUuid) {
usernameValue = credsFromUuid.login;
}
}
}
}
@ -1706,20 +1709,21 @@ kpxc.updateDatabaseState = async function() {
// Updates the TOTP Autocomplete Menu
kpxc.updateTOTPList = async function() {
let index = await sendMessage('page_get_login_id');
if (index < 0) {
let uuid = await sendMessage('page_get_login_id');
if (uuid === undefined) {
// Credential haven't been selected
return;
}
// Use the first credential available if not set
if (index === undefined) {
index = 0;
if (uuid === '') {
uuid = kpxc.credentials[0].uuid;
}
if (index >= 0 && kpxc.credentials[index]) {
const username = kpxc.credentials[index].login;
const password = kpxc.credentials[index].password;
const credentials = kpxc.credentials.find(c => c.uuid === uuid);
if (credentials) {
const username = credentials.login;
const password = credentials.password;
// If no username is set, compare with a password
const credentialList = kpxc.credentials.filter(c => (c.totp || (c.stringFields && c.stringFields.some(s => s['KPH: {TOTP}'])))

View file

@ -1,8 +1,8 @@
{
"manifest_version": 2,
"name": "KeePassXC-Browser",
"version": "1.7.8",
"version_name": "1.7.8",
"version": "1.7.8.1",
"version_name": "1.7.8.1",
"description": "__MSG_extensionDescription__",
"author": "KeePassXC Team",
"icons": {

View file

@ -1,6 +1,6 @@
{
"name": "KeePassXC-Browser",
"version": "1.7.8",
"version": "1.7.8.1",
"description": "KeePassXC-Browser",
"main": "build.js",
"devDependencies": {