diff --git a/src/angular/components/export.component.ts b/src/angular/components/export.component.ts index bad245f197..82b0ca5fb9 100644 --- a/src/angular/components/export.component.ts +++ b/src/angular/components/export.component.ts @@ -29,28 +29,13 @@ export class ExportComponent { } async submit() { - let acceptedWarning; - if (this.masterPassword == null || this.masterPassword === '') { this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'), this.i18nService.t('invalidMasterPassword')); return; } - if (this.encryptedFormat) { - acceptedWarning = await this.platformUtilsService.showDialog( - '
' + this.i18nService.t('encExportKeyWarningDesc') + - '
' + this.i18nService.t('encExportAccountWarningDesc'), - this.i18nService.t('confirmVaultExport'), this.i18nService.t('exportVault'), - this.i18nService.t('cancel'), 'warning', - true); - } else { - acceptedWarning = await this.platformUtilsService.showDialog( - this.i18nService.t('exportWarningDesc'), - this.i18nService.t('confirmVaultExport'), this.i18nService.t('exportVault'), - this.i18nService.t('cancel'), 'warning'); - } - + const acceptedWarning = await this.warningDialog(); if (!acceptedWarning) { return; } @@ -72,6 +57,22 @@ export class ExportComponent { } } + async warningDialog() { + if (this.encryptedFormat) { + return await this.platformUtilsService.showDialog( + '
' + this.i18nService.t('encExportKeyWarningDesc') + + '
' + this.i18nService.t('encExportAccountWarningDesc'), + this.i18nService.t('confirmVaultExport'), this.i18nService.t('exportVault'), + this.i18nService.t('cancel'), 'warning', + true); + } else { + return await this.platformUtilsService.showDialog( + this.i18nService.t('exportWarningDesc'), + this.i18nService.t('confirmVaultExport'), this.i18nService.t('exportVault'), + this.i18nService.t('cancel'), 'warning'); + } + } + togglePassword() { this.platformUtilsService.eventTrack('Toggled Master Password on Export'); this.showPassword = !this.showPassword;