mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Fix showing credential update popup
This commit is contained in:
parent
bf190d1faf
commit
0aceab17ad
5 changed files with 20 additions and 13 deletions
|
|
@ -8,7 +8,7 @@ const BLINK_TIMEOUT_REDIRECT_COUNT_DEFAULT = 1;
|
|||
|
||||
browserAction.show = function(callback, tab) {
|
||||
let data = {};
|
||||
if (!page.tabs[tab.id] || page.tabs[tab.id].stack.length == 0) {
|
||||
if (!page.tabs[tab.id] || page.tabs[tab.id].stack.length === 0) {
|
||||
browserAction.showDefault(callback, tab);
|
||||
return;
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@ browserAction.update = function(interval) {
|
|||
|
||||
let data = page.tabs[page.currentTabId].stack[page.tabs[page.currentTabId].stack.length - 1];
|
||||
|
||||
if (typeof data.visibleForMilliSeconds !== 'undefined') {
|
||||
if (data.visibleForMilliSeconds !== undefined) {
|
||||
if (data.visibleForMilliSeconds <= 0) {
|
||||
browserAction.stackPop(page.currentTabId);
|
||||
browserAction.show(null, {'id': page.currentTabId});
|
||||
|
|
@ -87,7 +87,7 @@ browserAction.showDefault = function(callback, tab) {
|
|||
});
|
||||
};
|
||||
|
||||
browserAction.stackAdd = function(callback, tab, icon, popup, level, push, visibleForMilliSeconds, visibleForPageUpdates, redirectOffset, dontShow) {
|
||||
browserAction.stackAdd = function(callback, tab, icon, popup, level, push, visibleForMilliSeconds, visibleForPageUpdates, redirectOffset, dontShow) {
|
||||
const id = tab.id || page.currentTabId;
|
||||
|
||||
if (!level) {
|
||||
|
|
@ -103,15 +103,15 @@ browserAction.stackAdd = function(callback, tab, icon, popup, level, push, visib
|
|||
stackData.popup = popup;
|
||||
}
|
||||
|
||||
if (visibleForMilliSeconds) {
|
||||
if (visibleForMilliSeconds !== undefined) {
|
||||
stackData.visibleForMilliSeconds = visibleForMilliSeconds;
|
||||
}
|
||||
|
||||
if (visibleForPageUpdates) {
|
||||
if (visibleForPageUpdates !== undefined) {
|
||||
stackData.visibleForPageUpdates = visibleForPageUpdates;
|
||||
}
|
||||
|
||||
if (redirectOffset) {
|
||||
if (redirectOffset !== undefined) {
|
||||
stackData.redirectOffset = redirectOffset;
|
||||
}
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ browserAction.removeRememberPopup = function(callback, tab, removeImmediately) {
|
|||
return;
|
||||
}
|
||||
|
||||
if( page.tabs[tab.id].stack.length == 0) {
|
||||
if (page.tabs[tab.id].stack.length === 0) {
|
||||
page.clearCredentials(tab.id);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ keepass.migrateKeyRing().then(() => {
|
|||
// Milliseconds for intervall (e.g. to update browserAction)
|
||||
const _interval = 250;
|
||||
|
||||
|
||||
/**
|
||||
* Generate information structure for created tab and invoke all needed
|
||||
* functions if tab is created in foreground
|
||||
|
|
@ -71,7 +70,13 @@ browser.tabs.onActivated.addListener((activeInfo) => {
|
|||
* @param {object} changeInfo
|
||||
*/
|
||||
browser.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
||||
// If the tab URL has changed (e.g. logged in) clear credentials
|
||||
if (changeInfo.url) {
|
||||
page.clearLogins(tabId);
|
||||
}
|
||||
|
||||
if (changeInfo.status === 'complete') {
|
||||
browserAction.showDefault(null, tab);
|
||||
kpxcEvent.invoke(browserAction.removeRememberPopup, null, tabId, []);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ keepass.updateCredentials = function(callback, tab, entryId, username, password,
|
|||
}
|
||||
else if (response.error && response.errorCode) {
|
||||
keepass.handleError(tab, response.errorCode, response.error);
|
||||
callback('error');
|
||||
}
|
||||
else {
|
||||
browserAction.showDefault(null, tab);
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ options.initGeneralSettings = function() {
|
|||
const blinkTimeout = $.trim($('#blinkTimeout').val());
|
||||
const blinkTimeoutval = blinkTimeout !== '' ? Number(blinkTimeout) : defaultSettings.blinkTimeout;
|
||||
|
||||
options.settings['blinkTimeout'] = String(blinkTimeoutval);
|
||||
options.settings['blinkTimeout'] = blinkTimeoutval;
|
||||
options.saveSetting('blinkTimeout');
|
||||
});
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ options.initGeneralSettings = function() {
|
|||
const blinkMinTimeout = $.trim($('#blinkMinTimeout').val());
|
||||
const blinkMinTimeoutval = blinkMinTimeout !== '' ? Number(blinkMinTimeout) : defaultSettings.redirectOffset;
|
||||
|
||||
options.settings['blinkMinTimeout'] = String(blinkMinTimeoutval);
|
||||
options.settings['blinkMinTimeout'] = blinkMinTimeoutval;
|
||||
options.saveSetting('blinkMinTimeout');
|
||||
});
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ options.initGeneralSettings = function() {
|
|||
const allowedRedirect = $.trim($('#allowedRedirect').val());
|
||||
const allowedRedirectval = allowedRedirect !== '' ? Number(allowedRedirect) : defaultSettings.redirectAllowance;
|
||||
|
||||
options.settings['allowedRedirect'] = String(allowedRedirectval);
|
||||
options.settings['allowedRedirect'] = allowedRedirectval;
|
||||
options.saveSetting('allowedRedirect');
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -108,9 +108,10 @@ function _connected_database(db) {
|
|||
}
|
||||
|
||||
function _verifyResult(code) {
|
||||
if (code === 'success') {
|
||||
_close();
|
||||
if (code === 'error') {
|
||||
showNotification('Error: Credentials cannot be saved or updated.');
|
||||
}
|
||||
_close();
|
||||
}
|
||||
|
||||
function _close() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue