mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Prevent multiple password generator requests
This commit is contained in:
parent
62c17e38fb
commit
eea5b78f98
1 changed files with 13 additions and 4 deletions
|
|
@ -15,6 +15,7 @@ keepass.latestVersionUrl = 'https://api.github.com/repos/keepassxreboot/keepassx
|
|||
keepass.cacheTimeout = 30 * 1000; // Milliseconds
|
||||
keepass.databaseHash = '';
|
||||
keepass.previousDatabaseHash = '';
|
||||
keepass.passwordRequestSent = false;
|
||||
keepass.reconnectLoop = null;
|
||||
|
||||
const kpActions = {
|
||||
|
|
@ -168,18 +169,24 @@ keepass.retrieveCredentials = async function(tab, args = []) {
|
|||
|
||||
keepass.generatePassword = async function(tab) {
|
||||
if (!keepass.isConnected) {
|
||||
return [];
|
||||
return '';
|
||||
}
|
||||
|
||||
if (keepass.passwordRequestSent) {
|
||||
return undefined;
|
||||
} else {
|
||||
keepass.passwordRequestSent = true;
|
||||
}
|
||||
|
||||
try {
|
||||
const taResponse = await keepass.testAssociation(tab);
|
||||
if (!taResponse) {
|
||||
browserAction.showDefault(tab);
|
||||
return [];
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!keepass.compareVersion(keepass.requiredKeePassXC, keepass.currentKeePassXC)) {
|
||||
return [];
|
||||
return '';
|
||||
}
|
||||
|
||||
let password;
|
||||
|
|
@ -201,10 +208,12 @@ keepass.generatePassword = async function(tab) {
|
|||
logError('generatePassword rejected');
|
||||
}
|
||||
|
||||
keepass.passwordRequestSent = false;
|
||||
return password;
|
||||
} catch (err) {
|
||||
logError(`generatePassword failed: ${err}`);
|
||||
return [];
|
||||
keepass.passwordRequestSent = false;
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue