Enable platform-specific export warning message (#295)

This commit is contained in:
Thomas Rittson 2021-03-05 08:56:20 +10:00 committed by GitHub
parent 8328b55774
commit b7acbcf3a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 16 deletions

View File

@ -29,28 +29,13 @@ export class ExportComponent {
} }
async submit() { async submit() {
let acceptedWarning;
if (this.masterPassword == null || this.masterPassword === '') { if (this.masterPassword == null || this.masterPassword === '') {
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'), this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
this.i18nService.t('invalidMasterPassword')); this.i18nService.t('invalidMasterPassword'));
return; return;
} }
if (this.encryptedFormat) { const acceptedWarning = await this.warningDialog();
acceptedWarning = await this.platformUtilsService.showDialog(
'<p>' + this.i18nService.t('encExportKeyWarningDesc') +
'<p>' + 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');
}
if (!acceptedWarning) { if (!acceptedWarning) {
return; return;
} }
@ -72,6 +57,22 @@ export class ExportComponent {
} }
} }
async warningDialog() {
if (this.encryptedFormat) {
return await this.platformUtilsService.showDialog(
'<p>' + this.i18nService.t('encExportKeyWarningDesc') +
'<p>' + 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() { togglePassword() {
this.platformUtilsService.eventTrack('Toggled Master Password on Export'); this.platformUtilsService.eventTrack('Toggled Master Password on Export');
this.showPassword = !this.showPassword; this.showPassword = !this.showPassword;