diff --git a/extension/popup.js b/extension/popup.js index 0423ba5..8c56514 100644 --- a/extension/popup.js +++ b/extension/popup.js @@ -115,11 +115,13 @@ document.getElementById('passwordCounter').addEventListener('input', generatePas function generatePassword() { const data = getFormData(); - if (!data.login || !data.masterPassword || !data.site) { + const generatedPasswordField = document.getElementById('generatedPasswordField'); + if (!data.login || !data.masterPassword || !data.site || !data.password.settings.length) { + generatedPasswordField.value = ''; return; } return lesspass.generatePassword(data.login, data.masterPassword, data.site, data).then(password => { - document.getElementById('generatedPasswordField').value = password; + generatedPasswordField.value = password; return password; }); }