Merge pull request #1724 from keepassxreboot/fix/hide_duplicate_totp_entry

Hide duplicate TOTP entry
This commit is contained in:
Sami Vänttinen 2022-10-07 07:43:17 +03:00 committed by GitHub
commit 4a6a99dcb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -388,6 +388,14 @@ kpxc.initLoginPopup = function() {
const loginItems = [];
for (let i = 0; i < kpxc.credentials.length; i++) {
const loginItem = getLoginItem(kpxc.credentials[i], showGroupNameInAutocomplete, i);
// Ignore a duplicate entry if the password is empty, but there's already a similar entry with a password.
// An usual use case with TOTP in a separate database.
const similarEntryFound = kpxc.credentials.some(c => c.password !== '' && c.login === loginItem.login);
if (kpxc.credentials[i].password === '' && similarEntryFound) {
continue;
}
loginItems.push(loginItem);
}