fix: handle vault unlock modal cancellation gracefully (#11356)

This commit is contained in:
Utkarsh Adhran
2026-07-11 11:50:26 +02:00
committed by GitHub
parent bda42fb514
commit eb424bb3a2
3 changed files with 27 additions and 1 deletions
+4
View File
@@ -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 ""
+18
View File
@@ -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'),
+5 -1
View File
@@ -178,7 +178,11 @@ export class VaultService {
async getPassphrase (): Promise<string> {
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