Develop #10

Merged
SemvdH merged 229 commits from develop into master 2020-10-29 22:50:49 +00:00
Showing only changes of commit b519f33cb5 - Show all commits

View File

@@ -166,6 +166,7 @@ namespace Server
private bool verifyLogin(string username, string password) private bool verifyLogin(string username, string password)
{ {
Console.WriteLine($"Got username {username} and password {password}");
if (!File.Exists(fileName)) if (!File.Exists(fileName))
@@ -180,27 +181,23 @@ namespace Server
{ {
Console.WriteLine("file exists, located at " + Path.GetFullPath(fileName)); Console.WriteLine("file exists, located at " + Path.GetFullPath(fileName));
string[] usernamesPasswords = File.ReadAllLines(fileName); string[] usernamesPasswords = File.ReadAllLines(fileName);
if (usernamesPasswords.Length == 0)
{
newUsers(username, password);
return true;
}
foreach (string s in usernamesPasswords) foreach (string s in usernamesPasswords)
{ {
string[] combo = s.Split(" "); string[] combo = s.Split(" ");
if (combo[0] == username) if (combo[0] == username)
{ {
Console.WriteLine("correct info"); Console.WriteLine("username found in file");
return combo[1] == password; return combo[1] == password;
} }
} }
Console.WriteLine("combo was not found in file"); Console.WriteLine("username not found in file");
newUsers(username, password);
return true;
} }
Console.WriteLine("false");
return false;
} }