diff --git a/locale/app.pot b/locale/app.pot index db3c85af..d9c049b1 100644 --- a/locale/app.pot +++ b/locale/app.pot @@ -2260,6 +2260,10 @@ msgstr "" msgid "Thank you for downloading Tabby!" msgstr "" +#: tabby-core/src/services/config.service.ts:471 +msgid "The vault must be unlocked to load your configuration." +msgstr "" + #: locale/tmp-html/tabby-settings/src/components/windowSettingsTab.component.html:5 msgid "Theme" msgstr "" diff --git a/tabby-core/src/services/config.service.ts b/tabby-core/src/services/config.service.ts index 4f7aa4ca..be81727c 100644 --- a/tabby-core/src/services/config.service.ts +++ b/tabby-core/src/services/config.service.ts @@ -466,6 +466,24 @@ export class ConfigService { decryptedVault = await this.vault.decrypt(store.vault, passphrase) break } catch (e) { + if (e.toString().includes('Vault unlock cancelled')) { + const cancelResult = await this.platform.showMessageBox({ + type: 'warning', + message: this.translate.instant('Vault is locked'), + detail: this.translate.instant('The vault must be unlocked to load your configuration.'), + buttons: [ + this.translate.instant('Try again'), + this.translate.instant('Quit'), + ], + defaultId: 0, + cancelId: 1, + }) + if (cancelResult.response === 1) { + this.platform.quit() + return {} + } + continue + } let result = await this.platform.showMessageBox({ type: 'error', message: this.translate.instant('Could not decrypt config'), diff --git a/tabby-core/src/services/vault.service.ts b/tabby-core/src/services/vault.service.ts index d9d67800..b29a87a7 100644 --- a/tabby-core/src/services/vault.service.ts +++ b/tabby-core/src/services/vault.service.ts @@ -178,7 +178,11 @@ export class VaultService { async getPassphrase (): Promise { if (!_rememberedPassphrase) { const modal = this.ngbModal.open(UnlockVaultModalComponent) - const { passphrase, rememberFor } = await modal.result + const result = await modal.result.catch(() => null) + if (!result) { + throw new Error('Vault unlock cancelled') + } + const { passphrase, rememberFor } = result setTimeout(() => { _rememberedPassphrase = null // avoid multiple consequent prompts