Merge pull request #771 from erri120/credentials-login-fix

Added more UI to the Credentials login form and catch exception
This commit is contained in:
Timothy Baldridge 2020-04-28 14:51:26 -06:00 committed by GitHub
commit 2c8b213d35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 10 deletions

View File

@ -1,5 +1,8 @@
### Changelog
#### Version - next
* Updated the Credentials Login form with more UI elements
#### Version - 2.0.2.0 - 4/27/2020
* Fixed mediafire links not getting resolved
* Fixed new mega links not being accepted

View File

@ -4,6 +4,7 @@ using System.Reactive.Linq;
using System.Security;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using Wabbajack.Common;
using Wabbajack.Lib;
using Wabbajack.Lib.Downloaders;
@ -34,14 +35,22 @@ namespace Wabbajack
public void Login(SecureString password)
{
if (password == null || password.Length == 0)
try
{
ReturnMessage = new LoginReturnMessage("You need to input a password!", true);
return;
}
if (password == null || password.Length == 0)
{
ReturnMessage = new LoginReturnMessage("You need to input a password!", true);
return;
}
ReturnMessage = _downloader.LoginWithCredentials(Username, password);
password.Clear();
ReturnMessage = _downloader.LoginWithCredentials(Username, password);
password.Clear();
}
catch (Exception e)
{
Utils.Error(e, "Exception while trying to login");
ReturnMessage = new LoginReturnMessage($"Unhandled exception: {e.Message}", true);
}
}
private static bool IsValidAddress(string s)

View File

@ -17,18 +17,22 @@
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>
<TextBox FontSize="20" x:Name="Username" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"/>
<PasswordBox Margin="0 16 0 -8" FontSize="20" x:Name="Password" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"/>
<TextBlock FontSize="20" Grid.Row="0" Grid.Column="0" Margin="0 16 8 0">Email:</TextBlock>
<TextBox FontSize="20" x:Name="Username" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2"/>
<Button Margin="8 8 0 0" x:Name="LoginButton" Grid.Row="2" Grid.Column="2" Click="LoginButton_OnClick">
<TextBlock FontSize="20" Grid.Row="1" Grid.Column="0" Margin="0 16 8 0">Password:</TextBlock>
<PasswordBox Margin="0 16 0 -8" FontSize="20" x:Name="Password" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"/>
<Button Margin="8 8 0 0" x:Name="LoginButton" Grid.Row="2" Grid.Column="3" Click="LoginButton_OnClick">
<TextBlock FontSize="14">Login</TextBlock>
</Button>
<TextBox x:Name="Message" FontSize="20" Margin="0 16 0 0" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3"/>
<TextBlock x:Name="Message" FontSize="20" Margin="0 16 0 0" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3"/>
</Grid>
</rxui:ReactiveUserControl>