1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-28 17:18:23 +01:00

Show vault export warning as popup (#1185)

This commit is contained in:
Matt Gibson 2020-12-18 16:47:34 -06:00 committed by GitHub
parent e0191c573d
commit 217514af66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 37 deletions

View File

@ -76,19 +76,6 @@
<Label <Label
Text="{u:I18n ExportVaultMasterPasswordDescription}" Text="{u:I18n ExportVaultMasterPasswordDescription}"
StyleClass="box-footer-label, box-footer-label-switch" /> StyleClass="box-footer-label, box-footer-label-switch" />
<Label
StyleClass="box-footer-label, box-footer-label-switch"
Margin="0, 20">
<Label.FormattedText>
<FormattedString>
<Span
Text="{Binding Converter={StaticResource toUpper}, ConverterParameter={u:I18n Warning}}"
FontAttributes="Bold" />
<Span Text=": " FontAttributes="Bold" />
<Span Text="{Binding ExportWarningMessage}" />
</FormattedString>
</Label.FormattedText>
</Label>
<StackLayout Spacing="20"> <StackLayout Spacing="20">
<Button Text="{u:I18n ExportVault}" <Button Text="{u:I18n ExportVault}"
Clicked="ExportVault_Clicked" Clicked="ExportVault_Clicked"

View File

@ -107,8 +107,20 @@ namespace Bit.App.Pages
MasterPassword = string.Empty; MasterPassword = string.Empty;
var storedKeyHash = await _cryptoService.GetKeyHashAsync(); var storedKeyHash = await _cryptoService.GetKeyHashAsync();
if (storedKeyHash != null && keyHash != null && storedKeyHash == keyHash) if (storedKeyHash == null || keyHash == null || storedKeyHash != keyHash)
{ {
await _platformUtilsService.ShowDialogAsync(_i18nService.T("InvalidMasterPassword"));
return;
}
bool userConfirmedExport = await _platformUtilsService.ShowDialogAsync(ExportWarningMessage,
_i18nService.T("ExportVaultConfirmationTitle"), _i18nService.T("ExportVault"), _i18nService.T("Cancel"));
if (!userConfirmedExport)
{
return;
}
try try
{ {
var data = await _exportService.GetExport(FileFormatOptions[FileFormatSelectedIndex].Key); var data = await _exportService.GetExport(FileFormatOptions[FileFormatSelectedIndex].Key);
@ -132,11 +144,6 @@ namespace Bit.App.Pages
#endif #endif
} }
} }
else
{
await _platformUtilsService.ShowDialogAsync(_i18nService.T("InvalidMasterPassword"));
}
}
public async void SaveFileSelected(string contentUri, string filename) public async void SaveFileSelected(string contentUri, string filename)
{ {

View File

@ -2827,6 +2827,14 @@ namespace Bit.App.Resources {
} }
} }
public static string ExportVaultConfirmationTitle
{
get
{
return ResourceManager.GetString("ExportVaultConfirmationTitle", resourceCulture);
}
}
public static string Warning { public static string Warning {
get { get {
return ResourceManager.GetString("Warning", resourceCulture); return ResourceManager.GetString("Warning", resourceCulture);

View File

@ -1605,6 +1605,10 @@
<data name="EncExportVaultWarning" xml:space="preserve"> <data name="EncExportVaultWarning" xml:space="preserve">
<value>This export encrypts your data using your account's encryption key. If you ever rotate your account's encryption key you should export again since you will not be able to decrypt this export file.</value> <value>This export encrypts your data using your account's encryption key. If you ever rotate your account's encryption key you should export again since you will not be able to decrypt this export file.</value>
</data> </data>
<data name="ExportVaultConfirmationTitle" xml:space="preserve">
<value>Confirm Vault Export</value>
<comment>Title for the alert to confirm vault exports.</comment>
</data>
<data name="Warning" xml:space="preserve"> <data name="Warning" xml:space="preserve">
<value>Warning</value> <value>Warning</value>
</data> </data>