Begin work on Unit Tests

This commit is contained in:
Li 2022-11-14 23:09:22 +13:00
parent cf7605c6c9
commit eaf1db1ee1
51 changed files with 3883 additions and 2101 deletions

View file

@ -30,8 +30,8 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.8.23.0")]
[assembly: AssemblyFileVersion("1.8.23.0")]
[assembly: AssemblyVersion("1.8.30.0")]
[assembly: AssemblyFileVersion("1.8.30.0")]

View file

@ -127,20 +127,19 @@ namespace MPN00BS
private void CreateAccount(object sender, RoutedEventArgs e)
{
int newUserId = Database.GetNextFreeUserId();
// Generate random salt
byte[] salt = new byte[64];
new Random(Guid.NewGuid().GetHashCode()).NextBytes(salt);
// Hash password
string saltText = BitConverter.ToString(salt).Replace("-", "");
string hashsalt = BitConverter.ToString(Authentication.HashAndSalt(passwordBox.Text, salt)).Replace("-", "");
// GENDer? I hardly knew THEM!
string gender = ((ComboBoxItem)genderSelectionBox.SelectedItem).Content.ToString();
// Permissions
bool admin = (bool)adminCheckbox.IsChecked;
bool mod = (bool)modCheckbox.IsChecked;
// Credentials
string password = passwordBox.Text;
string username = usernameBox.Text;
Database.CreateUser(newUserId, usernameBox.Text, hashsalt, saltText, gender, (bool)adminCheckbox.IsChecked, (bool)modCheckbox.IsChecked);
Authentication.CreateAccount(username, password, gender, admin, mod);
this.Close();
}

View file

@ -122,11 +122,6 @@ namespace MPN00BS
ProgressCallback();
if (Database.GetUsers().Length <= 0)
{
UserCreationCallback();
}
// Start HI1 Server
ProgressCallback();
@ -184,6 +179,11 @@ namespace MPN00BS
ProgressCallback();
HasServerStarted = true;
ServerStartedCallback();
if (Database.GetUsers().Length <= 0)
UserCreationCallback();
}
public static void ModifyConfig(string okey, string value)