1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

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

View File

@ -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(
'<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');
}
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(
'<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() {
this.platformUtilsService.eventTrack('Toggled Master Password on Export');
this.showPassword = !this.showPassword;