Improve filling from username icon

This commit is contained in:
varjolintu 2023-02-21 14:06:38 +02:00
parent e97df10c60
commit 34ddd915cd
3 changed files with 7 additions and 12 deletions

View file

@ -32,14 +32,10 @@ kpxcBanner.destroy = async function() {
kpxcBanner.create = async function(credentials = {}) {
const connectedDatabase = await sendMessage('get_connected_database');
if (!kpxc.settings.showLoginNotifications || kpxcBanner.created || connectedDatabase.identifier === null) {
return;
}
// Check if database is closed
const state = await sendMessage('check_database_hash');
if (state === '') {
//kpxcUI.createNotification('error', tr('rememberErrorDatabaseClosed'));
if (!kpxc.settings.showLoginNotifications
|| kpxcBanner.created
|| connectedDatabase.identifier === null
|| kpxc.databaseState !== DatabaseState.UNLOCKED) {
return;
}

View file

@ -115,7 +115,7 @@ kpxc.detectDatabaseChange = async function(response) {
// If user has requested a manual fill through context menu the actual credential filling
// is handled here when the opened database has been regognized. It's not a pretty hack.
const manualFill = await sendMessage('page_get_manual_fill');
if (manualFill !== ManualFill.NONE) {
if (manualFill !== ManualFill.NONE && kpxc.combinations.length > 0) {
await kpxcFill.fillInFromActiveElement(manualFill === ManualFill.PASSWORD);
await sendMessage('page_set_manual_fill', ManualFill.NONE);
}

View file

@ -131,8 +131,7 @@ const iconClicked = async function(field, icon) {
return;
}
const databaseHash = await sendMessage('check_database_hash');
if (databaseHash === '') {
if (kpxc.databaseState !== DatabaseState.UNLOCKED) {
// Triggers database unlock
await sendMessage('page_set_manual_fill', ManualFill.BOTH);
await sendMessage('get_database_hash', [ false, true ]); // Set triggerUnlock to true
@ -148,7 +147,7 @@ const getIconClassName = function(state = DatabaseState.UNLOCKED) {
if (state === DatabaseState.LOCKED) {
return (isFirefox() ? 'lock-moz' : 'lock');
} else if (state === DatabaseState.DISCONNECTED) {
return (isFirefox() ? 'lock-disconnected' : 'disconnected');
return (isFirefox() ? 'disconnected-moz' : 'disconnected');
}
return (isFirefox() ? 'unlock-moz' : 'unlock');