Fix login popup change with locked database

This commit is contained in:
varjolintu 2023-01-24 18:10:28 +02:00
parent 6447e32fe6
commit b1e7186194
4 changed files with 14 additions and 20 deletions

View file

@ -37,17 +37,9 @@ browserAction.showDefault = async function(tab) {
popupData.iconType = 'locked';
}
if (page.tabs[tab.id] && page.tabs[tab.id].loginList.length > 0) {
popupData.iconType = 'questionmark';
popupData.popup = 'popup_login';
}
browserAction.show(tab, popupData);
};
browserAction.updateIcon = async function(tab, iconType) {
// Get the current tab if no tab given
if (!tab) {
const tabs = await browser.tabs.query({ 'active': true, 'currentWindow': true });
const tabs = await browser.tabs.query({ active: true, currentWindow: true });
if (tabs.length === 0) {
return;
}
@ -55,9 +47,12 @@ browserAction.updateIcon = async function(tab, iconType) {
tab = tabs[0];
}
browser.browserAction.setIcon({
path: browserAction.generateIconName(iconType)
});
if (page.tabs[tab.id] && page.tabs[tab.id].loginList.length > 0) {
popupData.iconType = 'questionmark';
popupData.popup = 'popup_login';
}
browserAction.show(tab, popupData);
};
browserAction.generateIconName = function(iconType) {
@ -72,7 +67,7 @@ browserAction.ignoreSite = async function(url) {
await browser.windows.getCurrent();
// Get current active window
const tabs = await browser.tabs.query({ 'active': true, 'currentWindow': true });
const tabs = await browser.tabs.query({ active: true, currentWindow: true });
const tab = tabs[0];
// Send the message to the current tab's content script

View file

@ -855,9 +855,9 @@ keepass.handleError = function(tab, errorCode, errorMessage = '') {
}
};
keepass.updatePopup = function(iconType) {
keepass.updatePopup = function() {
if (page && page.tabs.length > 0) {
browserAction.updateIcon(undefined, iconType);
browserAction.showDefault();
}
};
@ -868,9 +868,8 @@ keepass.updateDatabase = async function() {
page.clearAllLogins();
await keepass.testAssociation(null, [ true ]);
const configured = await keepass.isConfigured();
keepass.updatePopup(configured ? 'normal' : 'locked');
keepass.updatePopup();
keepass.updateDatabaseHashToContent();
};

View file

@ -48,7 +48,7 @@
<p style="margin-left: 1em">
<code id="database-error-message"></code>
</p>
<div style="text-align: right">
<div class="right-align">
<button id="reopen-database-button" class="btn btn-sm btn-primary"><i class="fa fa-lock" aria-hidden="true"></i> <span data-i18n="popupReopenButton"></span></button>
</div>
</div>

View file

@ -49,7 +49,7 @@
<p style="margin-left: 1em">
<code id="database-error-message"></code>
</p>
<div id="right-align">
<div class="right-align">
<button id="reopen-database-button" class="btn btn-sm btn-primary"><i class="fa fa-lock" aria-hidden="true"></i> <span data-i18n="popupReopenButton"></span></button>
</div>
</div>