Error message when T&C is declined
MODIFY
WalletWasabi.Fluent/ViewModels/Login/LoginViewModel.cs
WalletWasabi.Fluent/ViewModels/Login/LoginViewModel.cs
using System.Threading.Tasks;
using System.Windows.Input;
using ReactiveUI;
-using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Fluent.ViewModels.AddWallet;
using WalletWasabi.Fluent.ViewModels.Login.PasswordFinder;
using WalletWasabi.Fluent.ViewModels.Navigation;
@@ -15,16 +14,16 @@ namespace WalletWasabi.Fluent.ViewModels.Login
public partial class LoginViewModel : RoutableViewModel
{
[AutoNotify] private string _password;
- [AutoNotify] private bool _isPasswordIncorrect;
[AutoNotify] private bool _isPasswordNeeded;
- [AutoNotify] private string _walletName;
+ [AutoNotify] private string _errorMessage;
public LoginViewModel(WalletManagerViewModel walletManagerViewModel, ClosedWalletViewModel closedWalletViewModel)
{
var wallet = closedWalletViewModel.Wallet;
IsPasswordNeeded = !wallet.KeyManager.IsWatchOnly;
- _walletName = wallet.WalletName;
+ WalletName = wallet.WalletName;
_password = "";
+ _errorMessage = "";
WalletIcon = wallet.KeyManager.Icon;
IsHardwareWallet = wallet.KeyManager.IsHardwareWallet;
@@ -32,10 +31,11 @@ namespace WalletWasabi.Fluent.ViewModels.Login
{
string? compatibilityPasswordUsed = null;
- IsPasswordIncorrect = !await Task.Run(() => wallet.TryLogin(Password, out compatibilityPasswordUsed));
+ var isPasswordCorrect = await Task.Run(() => wallet.TryLogin(Password, out compatibilityPasswordUsed));
- if (IsPasswordIncorrect)
+ if (!isPasswordCorrect)
{
+ ErrorMessage = "The password is incorrect! Try Again.";
return;
}
@@ -53,14 +53,14 @@ namespace WalletWasabi.Fluent.ViewModels.Login
else
{
wallet.Logout();
- Password = "";
+ ErrorMessage = "You must accept the Terms and Conditions!";
}
});
OkCommand = ReactiveCommand.Create(() =>
{
Password = "";
- IsPasswordIncorrect = false;
+ ErrorMessage = "";
});
ForgotPasswordCommand = ReactiveCommand.Create(() =>
@@ -73,6 +73,8 @@ namespace WalletWasabi.Fluent.ViewModels.Login
public bool IsHardwareWallet { get; }
+ public string WalletName { get; }
+
public ICommand OkCommand { get; }
public ICommand ForgotPasswordCommand { get; }

MODIFY
WalletWasabi.Fluent/Views/Login/LoginView.axaml
WalletWasabi.Fluent/Views/Login/LoginView.axaml
FontWeight="ExtraLight"
Margin="0 10"/>
- <DockPanel IsVisible="{Binding !IsPasswordIncorrect}"
+ <DockPanel IsVisible="{Binding ErrorMessage, Converter={x:Static StringConverters.IsNullOrEmpty}}"
Classes="fadeAnimation">
<!-- Enter password -->
</TextBox>
<Panel Margin="0 -20 0 0 ">
<Button Classes="activeHyperLink skip" Content="Forgot password?" HorizontalAlignment="Left" Command="{Binding ForgotPasswordCommand}"/>
- <Button Content="Login" IsDefault="{Binding !IsPasswordIncorrect}" Focusable="False" Classes="action" HorizontalAlignment="Right" Command="{Binding NextCommand}">
+ <Button Content="Login" IsDefault="{Binding ErrorMessage, Converter={x:Static StringConverters.IsNullOrEmpty}}" Focusable="False" Classes="action" HorizontalAlignment="Right" Command="{Binding NextCommand}">
</Button>
</Panel>
<!-- Incorrect password -->
<StackPanel Spacing="20"
Margin="0,11,0,0"
- IsVisible="{Binding IsPasswordIncorrect}"
+ IsVisible="{Binding ErrorMessage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
VerticalAlignment="Bottom"
Classes="fadeAnimation">
- <TextBlock Text="The password is incorrect! Try Again." HorizontalAlignment="Center"/>
- <Button Content="OK" IsDefault="{Binding IsPasswordIncorrect}" Focusable="False" Classes="action" HorizontalAlignment="Center" Command="{Binding OkCommand}"/>
+ <TextBlock Text="{Binding ErrorMessage}" HorizontalAlignment="Center" />
+ <Button Content="OK" IsDefault="{Binding ErrorMessage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Focusable="False" Classes="action" HorizontalAlignment="Center" Command="{Binding OkCommand}" />
</StackPanel>
</StackPanel>

Error message when T&C is declined