diff --git a/Knossos.NET/Models/ModMember.cs b/Knossos.NET/Models/ModMember.cs index 707844c2..8ee5bd96 100644 --- a/Knossos.NET/Models/ModMember.cs +++ b/Knossos.NET/Models/ModMember.cs @@ -20,7 +20,13 @@ public enum ModMemberRole public class ModMember { + private string _user = string.Empty; + public ModMemberRole role { get; set; } - public string user { get; set; } = string.Empty; + public string user + { + get { return _user; } + set { _user = value.Trim(); } + } } } diff --git a/Knossos.NET/ViewModels/Templates/NebulaLoginViewModel.cs b/Knossos.NET/ViewModels/Templates/NebulaLoginViewModel.cs index 52ebc85b..0a69cde1 100644 --- a/Knossos.NET/ViewModels/Templates/NebulaLoginViewModel.cs +++ b/Knossos.NET/ViewModels/Templates/NebulaLoginViewModel.cs @@ -97,7 +97,10 @@ internal async void Install() internal async void LogIn() { - if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(UserPass) || string.IsNullOrWhiteSpace(UserName) || string.IsNullOrWhiteSpace(UserPass)) + UserName = UserName?.Trim(); + UserPass = UserPass?.Trim(); + + if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(UserPass)) { await MessageBox.Show(MainWindow.instance!, "Username and password are required fields.", "Login error", MessageBox.MessageBoxButtons.OK); return; @@ -134,8 +137,11 @@ internal void SwitchToLogin() internal async void Register() { - if(string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(UserPass) || string.IsNullOrEmpty(UserEmail) || - string.IsNullOrWhiteSpace(UserName) || string.IsNullOrWhiteSpace(UserPass) || string.IsNullOrWhiteSpace(UserEmail)) + UserName = UserName?.Trim(); + UserPass = UserPass?.Trim(); + UserEmail = UserEmail.Trim(); + + if(string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(UserPass) || string.IsNullOrEmpty(UserEmail)) { await MessageBox.Show(MainWindow.instance!, "Username, password and email are all required fields.", "Register error", MessageBox.MessageBoxButtons.OK); return; @@ -165,7 +171,9 @@ internal async void Register() internal async void Reset() { - if (string.IsNullOrEmpty(UserName) || string.IsNullOrWhiteSpace(UserName)) + UserName = UserName?.Trim(); + + if (string.IsNullOrEmpty(UserName)) { await MessageBox.Show(MainWindow.instance!, "Username is a required field.", "Reset password", MessageBox.MessageBoxButtons.OK); return;