From 6bcf36b21e6b15e586dd22f8e48dac30aa45de12 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Wed, 16 Mar 2016 09:10:24 +0100 Subject: [PATCH] More debugging --- Logic/Security/Authentication.cs | 6 +----- Logic/Support/SwarmopsLog.cs | 2 +- Logic/Swarm/Person.cs | 4 ++-- Site5/Pages/v5/Public/Initialize.aspx.cs | 10 ++++++---- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Logic/Security/Authentication.cs b/Logic/Security/Authentication.cs index 9ddc6fb2..a09506bb 100644 --- a/Logic/Security/Authentication.cs +++ b/Logic/Security/Authentication.cs @@ -29,7 +29,7 @@ namespace Swarmops.Logic.Security /// 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); } diff --git a/Logic/Support/SwarmopsLog.cs b/Logic/Support/SwarmopsLog.cs index bd332ad4..fc1b6866 100644 --- a/Logic/Support/SwarmopsLog.cs +++ b/Logic/Support/SwarmopsLog.cs @@ -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"); } } } diff --git a/Logic/Swarm/Person.cs b/Logic/Swarm/Person.cs index c426e0c9..29bd7f18 100644 --- a/Logic/Swarm/Person.cs +++ b/Logic/Swarm/Person.cs @@ -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; } diff --git a/Site5/Pages/v5/Public/Initialize.aspx.cs b/Site5/Pages/v5/Public/Initialize.aspx.cs index 28d47ae5..7d3ddfcf 100644 --- a/Site5/Pages/v5/Public/Initialize.aspx.cs +++ b/Site5/Pages/v5/Public/Initialize.aspx.cs @@ -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)))