More debugging

This commit is contained in:
Rick Falkvinge
2016-03-16 09:10:24 +01:00
parent 86008caab4
commit 6bcf36b21e
4 changed files with 10 additions and 12 deletions
+1 -5
View File
@@ -29,7 +29,7 @@ namespace Swarmops.Logic.Security
/// </exception>
public static Person Authenticate (string loginToken, string password)
{
SwarmopsLog.DebugLog(string.Format("Authenticating '{0}' against '{1}'", loginToken, password));
SwarmopsLog.DebugLog(string.Format("Authenticating '{0}'", loginToken, password));
// Get the list of people that match the login token.
@@ -164,8 +164,6 @@ namespace Swarmops.Logic.Security
// Longer than standard (10) on purpose. Should be good through 2020 or so.
string passwordHash = BCrypt.HashPassword (personId.ToString (CultureInfo.InvariantCulture) + password, salt);
SwarmopsLog.DebugLog ("- storing salted pwd " + passwordHash);
return passwordHash;
}
@@ -177,8 +175,6 @@ namespace Swarmops.Logic.Security
return false; // not a BCrypt hash with work factor 12; fall back to legacy or fail. Caller's problem
}
SwarmopsLog.DebugLog ("- password hash is " + person.PasswordHash);
return BCrypt.CheckPassword (person.Identity.ToString (CultureInfo.InvariantCulture) + password,
person.PasswordHash);
}
+1 -1
View File
@@ -32,7 +32,7 @@ namespace Swarmops.Logic.Support
{
// Linux - the reason we made this function to begin with
File.AppendAllText ("/tmp/swarmops-debug.log", DateTime.UtcNow.ToString("yyyy-MM-dd/HH:mm:ss.fff ") + logEntry + @"\n");
File.AppendAllText ("/tmp/swarmops-debug.log", DateTime.UtcNow.ToString("yyyy-MM-dd/HH:mm:ss.fff | ") + logEntry + @"\r\n");
}
}
}
+2 -2
View File
@@ -793,11 +793,11 @@ namespace Swarmops.Logic.Swarm
public Participation AddParticipation (Organization organization, DateTime expires)
{
SwarmopsLog.DebugLog (string.Format("Adding participation in {0} until {1:yyyy-MM-dd HH:mm:ss}", organization.Name, expires));
SwarmopsLog.DebugLog (string.Format("- adding participation in {0} until {1:yyyy-MM-dd HH:mm:ss}", organization.Name, expires));
Participation participation = AddParticipation (organization.Identity, expires);
SwarmopsLog.DebugLog ("Created participation #" + (participation != null? participation.Identity.ToString() : "null"));
SwarmopsLog.DebugLog ("- created participation #" + (participation != null? participation.Identity.ToString() : "null"));
return participation;
}
+6 -4
View File
@@ -717,16 +717,16 @@ namespace Swarmops.Frontend.Pages.v5.Public
throw new InvalidOperationException ("Cannot run initialization processes again when initialized.");
}
SwarmopsLog.DebugLog("Person one did not exist, creating");
SwarmopsLog.DebugLog("- person one did not exist, creating");
Person newPerson = Person.Create (name, mail, password, string.Empty, string.Empty, string.Empty,
string.Empty, string.Empty, DateTime.MinValue, PersonGender.Unknown);
SwarmopsLog.DebugLog("Adding participation in Sandbox");
SwarmopsLog.DebugLog("- adding participation in Sandbox");
newPerson.AddParticipation (Organization.Sandbox, DateTime.MaxValue); // Add membership in Sandbox
newPerson.AddParticipation (Organization.Sandbox, DateTime.UtcNow.AddYears (25)); // Add membership in Sandbox
SwarmopsLog.DebugLog ("Creating positions");
SwarmopsLog.DebugLog ("- creating positions");
// Initialize staffing to System and Sandbox with the new user
@@ -738,6 +738,8 @@ namespace Swarmops.Frontend.Pages.v5.Public
protected void ButtonLogin_Click (object sender, EventArgs args)
{
SwarmopsLog.DebugLog("ButtonLogin_Click");
// Check the host names and addresses again as a security measure - after all, we can be called from outside our intended script
if (!(VerifyHostName (this.TextServerName.Text) && VerifyHostAddress (this.TextServerAddress.Text)))