mirror of
https://github.com/bitwarden/mobile
synced 2025-12-10 05:13:31 +00:00
Show vault export warning as popup (#1185)
This commit is contained in:
@@ -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"
|
||||||
|
|||||||
@@ -107,34 +107,41 @@ 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)
|
||||||
{
|
{
|
||||||
try
|
await _platformUtilsService.ShowDialogAsync(_i18nService.T("InvalidMasterPassword"));
|
||||||
{
|
return;
|
||||||
var data = await _exportService.GetExport(FileFormatOptions[FileFormatSelectedIndex].Key);
|
}
|
||||||
var fileFormat = FileFormatOptions[FileFormatSelectedIndex].Key;
|
|
||||||
_defaultFilename = _exportService.GetFileName(null, fileFormat);
|
|
||||||
_exportResult = Encoding.ASCII.GetBytes(data);
|
|
||||||
|
|
||||||
if (!_deviceActionService.SaveFile(_exportResult, null, _defaultFilename, null))
|
bool userConfirmedExport = await _platformUtilsService.ShowDialogAsync(ExportWarningMessage,
|
||||||
{
|
_i18nService.T("ExportVaultConfirmationTitle"), _i18nService.T("ExportVault"), _i18nService.T("Cancel"));
|
||||||
ClearResult();
|
|
||||||
await _platformUtilsService.ShowDialogAsync(_i18nService.T("ExportVaultFailure"));
|
if (!userConfirmedExport)
|
||||||
}
|
{
|
||||||
}
|
return;
|
||||||
catch (Exception ex)
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = await _exportService.GetExport(FileFormatOptions[FileFormatSelectedIndex].Key);
|
||||||
|
var fileFormat = FileFormatOptions[FileFormatSelectedIndex].Key;
|
||||||
|
_defaultFilename = _exportService.GetFileName(null, fileFormat);
|
||||||
|
_exportResult = Encoding.ASCII.GetBytes(data);
|
||||||
|
|
||||||
|
if (!_deviceActionService.SaveFile(_exportResult, null, _defaultFilename, null))
|
||||||
{
|
{
|
||||||
ClearResult();
|
ClearResult();
|
||||||
await _platformUtilsService.ShowDialogAsync(_i18nService.T("ExportVaultFailure"));
|
await _platformUtilsService.ShowDialogAsync(_i18nService.T("ExportVaultFailure"));
|
||||||
System.Diagnostics.Debug.WriteLine(">>> {0}: {1}", ex.GetType(), ex.StackTrace);
|
|
||||||
#if !FDROID
|
|
||||||
Crashes.TrackError(ex);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await _platformUtilsService.ShowDialogAsync(_i18nService.T("InvalidMasterPassword"));
|
ClearResult();
|
||||||
|
await _platformUtilsService.ShowDialogAsync(_i18nService.T("ExportVaultFailure"));
|
||||||
|
System.Diagnostics.Debug.WriteLine(">>> {0}: {1}", ex.GetType(), ex.StackTrace);
|
||||||
|
#if !FDROID
|
||||||
|
Crashes.TrackError(ex);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
8
src/App/Resources/AppResources.Designer.cs
generated
8
src/App/Resources/AppResources.Designer.cs
generated
@@ -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);
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user