get forms anyway even if no matches

This commit is contained in:
Evert Prants 2022-08-28 10:39:55 +03:00
parent caea4f90fd
commit 8f380ed30b
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 10 additions and 7 deletions

View File

@ -3,6 +3,7 @@
let currentForm = null; let currentForm = null;
let successfulAttachment = false; let successfulAttachment = false;
let focusedField = null; let focusedField = null;
let loginForms = [];
function generateQuerySelector(el) { function generateQuerySelector(el) {
if (el.tagName.toLowerCase() === 'html') { if (el.tagName.toLowerCase() === 'html') {
@ -184,10 +185,9 @@
}); });
} }
function init() { function createFormHighlights() {
const forms = lookForLoginForms(); if (loginForms.length) {
if (forms.length) { loginForms.forEach((form) => attachLoginFormHighlight(form));
forms.forEach((form) => attachLoginFormHighlight(form));
} }
} }
@ -209,7 +209,7 @@
) { ) {
if (request.message === 'has_entries') { if (request.message === 'has_entries') {
currentPageMatches = request.payload; currentPageMatches = request.payload;
init(); createFormHighlights();
sendResponse(true); sendResponse(true);
} }
@ -244,7 +244,9 @@
} }
if (e.target && e.target.tagName === 'INPUT') { if (e.target && e.target.tagName === 'INPUT') {
init(); createFormHighlights();
} }
}); });
loginForms = lookForLoginForms();
})(); })();

View File

@ -36,7 +36,8 @@ async function findSiteInPasswords(siteDomain) {
.filter((item) => { .filter((item) => {
const name = item.toLowerCase(); const name = item.toLowerCase();
return name.includes(siteDomain) || (sdwTLD && name.includes(sdwTLD)); return name.includes(siteDomain) || (sdwTLD && name.includes(sdwTLD));
}); })
.slice(0, 4);
} }
async function getPassword(password) { async function getPassword(password) {