use error dialog, disallow empty pw
MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/EnterPasswordViewModel.cs
WalletWasabi.Fluent/ViewModels/Dialogs/EnterPasswordViewModel.cs
@@ -11,7 +11,7 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
[AutoNotify] private string? _confirmPassword;
[AutoNotify] private string? _password;
- public EnterPasswordViewModel(string caption)
+ public EnterPasswordViewModel(string caption, bool enableEmpty = true)
{
Title = "Enter a password";
Caption = caption;
@@ -35,7 +35,10 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
this.RaisePropertyChanged(nameof(Password));
this.RaisePropertyChanged(nameof(ConfirmPassword));
- return IsDialogOpen && ((string.IsNullOrEmpty(Password) && string.IsNullOrEmpty(ConfirmPassword)) || (!string.IsNullOrEmpty(Password) && !string.IsNullOrEmpty(ConfirmPassword) && !Validations.Any));
+
+ return IsDialogOpen &&
+ ((enableEmpty && string.IsNullOrEmpty(Password) && string.IsNullOrEmpty(ConfirmPassword)) ||
+ (!string.IsNullOrEmpty(Password) && !string.IsNullOrEmpty(ConfirmPassword) && !Validations.Any));
})
.ObserveOn(RxApp.MainThreadScheduler);

MODIFY
WalletWasabi.Fluent/ViewModels/Login/PasswordFinder/PasswordFinderIntroduceViewModel.cs
WalletWasabi.Fluent/ViewModels/Login/PasswordFinder/PasswordFinderIntroduceViewModel.cs
@@ -15,13 +15,18 @@ namespace WalletWasabi.Fluent.ViewModels.Login.PasswordFinder
NextCommand = ReactiveCommand.CreateFromTask(async () =>
{
var dialogResult =
- await NavigateDialog(new EnterPasswordViewModel("Type in your incorrect password."));
+ await NavigateDialog(new EnterPasswordViewModel("Type in your incorrect password.", enableEmpty: false));
if (dialogResult.Result is { } password)
{
var options = new PasswordFinderOptions(wallet, password);
Navigate().To(new SelectCharsetViewModel(options));
}
+
+ if (dialogResult.Kind == DialogResultKind.Cancel)
+ {
+ Navigate().Clear();
+ }
});
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Login/PasswordFinder/PasswordFinderResultViewModel.cs
WalletWasabi.Fluent/ViewModels/Login/PasswordFinder/PasswordFinderResultViewModel.cs
@@ -7,11 +7,10 @@ namespace WalletWasabi.Fluent.ViewModels.Login.PasswordFinder
[AutoNotify] private string? _password;
[AutoNotify] private bool _success;
- public PasswordFinderResultViewModel(string? password)
+ public PasswordFinderResultViewModel(string password)
{
Title = "Password Finder";
_password = password;
- _success = password is { };
NextCommand = CancelCommand;
}

MODIFY
WalletWasabi.Fluent/ViewModels/Login/PasswordFinder/SearchPasswordViewModel.cs
WalletWasabi.Fluent/ViewModels/Login/PasswordFinder/SearchPasswordViewModel.cs
@@ -25,22 +25,28 @@ namespace WalletWasabi.Fluent.ViewModels.Login.PasswordFinder
_hourText = "";
_minText = "";
_secText = "";
- CancelToken = new CancellationTokenSource();
+ var cancelToken = new CancellationTokenSource();
- Task.Run(() =>
+ Task.Run(async () =>
+ {
+ if (PasswordFinderHelper.TryFind(options, out var foundPassword, SetStatus, cancelToken.Token))
{
- PasswordFinderHelper.TryFind(options, out var foundPassword, SetStatus, CancelToken.Token);
Navigate().To(new PasswordFinderResultViewModel(foundPassword));
+ }
+ else
+ {
+ await ShowErrorAsync("We have not found your password, try search again with different options.", "The search has been finished, see the result below.");
+ Navigate().Clear();
+ }
});
CancelCommand = ReactiveCommand.Create(() =>
{
- CancelToken.Cancel();
+ cancelToken.Cancel();
Navigate().Clear();
});
}
- private CancellationTokenSource CancelToken { get; }
private void SetStatus(int percentage, TimeSpan remainingTime)
{

MODIFY
WalletWasabi.Fluent/Views/Login/PasswordFinder/PasswordFinderResultView.axaml
WalletWasabi.Fluent/Views/Login/PasswordFinder/PasswordFinderResultView.axaml
EnableCancel="False"
EnableBack="False">
<DockPanel>
- <DockPanel.Styles>
- <Style Selector="StackPanel">
- <Setter Property="Margin" Value="0 40"/>
- <Setter Property="Spacing" Value="15"/>
- <Setter Property="HorizontalAlignment" Value="Stretch"/>
- <Setter Property="DockPanel.Dock" Value="Bottom"/>
- </Style>
- </DockPanel.Styles>
-
- <StackPanel IsVisible="{Binding Success}">
- <TextBlock Text="We have succesfully found your password, click below to reveal it." TextAlignment="Center" TextWrapping="Wrap" />
+ <StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Stretch" Spacing="15" Margin="0 40">
+ <TextBlock Text="We have successfully found your password, click below to reveal it." TextAlignment="Center" TextWrapping="Wrap" />
<TextBlock Text="{Binding Password}" HorizontalAlignment="Center"/>
</StackPanel>
-
- <StackPanel IsVisible="{Binding !Success}">
- <TextBlock Text="We have not found your password, try search again with different options." TextAlignment="Center" TextWrapping="Wrap" />
- </StackPanel>
-
<Viewbox MaxHeight="150" HorizontalAlignment="Center" VerticalAlignment="Center">
- <Panel>
- <PathIcon IsVisible="{Binding Success}" Data="{StaticResource checkmark_filled}" Foreground="{DynamicResource SystemControlBackgroundAccentBrush}" />
- <PathIcon IsVisible="{Binding !Success}" Data="{StaticResource dismiss_regular}" Foreground="{DynamicResource SystemErrorTextColor}" />
- </Panel>
+ <PathIcon Data="{StaticResource checkmark_filled}" Foreground="{DynamicResource SystemControlBackgroundAccentBrush}" />
</Viewbox>
-
</DockPanel>
</c:ContentArea>
</UserControl>

use error dialog, disallow empty pw