Wait for user to log in before trying to save credentials

This commit is contained in:
Daniel James Smith 2021-09-30 16:43:10 +02:00
parent 5c175e2201
commit 838bfe9454
No known key found for this signature in database
GPG Key ID: 03E4BD365FF06726
3 changed files with 35 additions and 18 deletions

View File

@ -127,6 +127,7 @@ export default class MainBackground {
onReplacedRan: boolean;
loginToAutoFill: any = null;
notificationQueue: any[] = [];
retryQueue: any[] = [];
private commandsBackground: CommandsBackground;
private contextMenusBackground: ContextMenusBackground;

View File

@ -71,6 +71,18 @@ export default class RuntimeBackground {
await this.main.refreshBadgeAndMenu(false);
this.notificationsService.updateConnection(msg.command === 'unlocked');
this.systemService.cancelProcessReload();
if (this.main.retryQueue.length > 0) {
const retryItem = this.main.retryQueue.pop();
await this.processMessage(retryItem.msg, retryItem.sender, null);
}
break;
case 'addToRetryQueue':
const retryMessage = {
msg: msg.retryItem,
sender: sender,
};
this.main.retryQueue.push(retryMessage);
break;
case 'logout':
await this.main.logout(msg.expired);
@ -224,10 +236,6 @@ export default class RuntimeBackground {
}
private async saveAddLogin(tab: any, folderId: string) {
console.log('saveAddLogin triggered');
if (await this.vaultTimeoutService.isLocked()) {
return;
}
for (let i = this.main.notificationQueue.length - 1; i >= 0; i--) {
const queueMessage = this.main.notificationQueue[i];
@ -268,10 +276,6 @@ export default class RuntimeBackground {
}
private async saveChangePassword(tab: any) {
console.log('saveChangePassword triggered');
if (await this.vaultTimeoutService.isLocked()) {
return;
}
for (let i = this.main.notificationQueue.length - 1; i >= 0; i--) {
const queueMessage = this.main.notificationQueue[i];

View File

@ -73,6 +73,12 @@ document.addEventListener('DOMContentLoaded', () => {
sendPlatformMessage({
command: 'openPopout'
});
sendPlatformMessage({
command: 'addToRetryQueue',
retryItem: bgAddSaveMessage
});
return;
}
sendPlatformMessage(bgAddSaveMessage);
@ -111,6 +117,12 @@ document.addEventListener('DOMContentLoaded', () => {
sendPlatformMessage({
command: 'openPopout'
});
sendPlatformMessage({
command: 'addToRetryQueue',
retryItem: bgChangeSaveMessage,
});
return;
}
sendPlatformMessage(bgChangeSaveMessage);
});