Turns out that OmniServer doesn't refactor after all, who knew? Fix build.

This commit is contained in:
Lucas Nicodemus 2015-04-13 23:31:38 -06:00
parent b34c00107c
commit c5034a23ad

View file

@ -355,16 +355,16 @@ namespace TShockAPI.DB
if (BCrypt.Net.BCrypt.Verify(password, this.Password)) if (BCrypt.Net.BCrypt.Verify(password, this.Password))
{ {
// If necessary, perform an upgrade to the highest work factor. // If necessary, perform an upgrade to the highest work factor.
upgradePasswordWorkFactor(password); UpgradePasswordWorkFactor(password);
return true; return true;
} }
} }
catch (SaltParseException) catch (SaltParseException)
{ {
if (hashPassword(password).ToUpper() == this.Password.ToUpper()) if (HashPassword(password).ToUpper() == this.Password.ToUpper())
{ {
// The password is not stored using BCrypt; upgrade it to BCrypt immediately // The password is not stored using BCrypt; upgrade it to BCrypt immediately
upgradePasswordToBCrypt(password); UpgradePasswordToBCrypt(password);
return true; return true;
} }
return false; return false;
@ -406,13 +406,15 @@ namespace TShockAPI.DB
protected internal void UpgradePasswordWorkFactor(string password) protected internal void UpgradePasswordWorkFactor(string password)
{ {
// If the destination work factor is not greater, we won't upgrade it or re-hash it // If the destination work factor is not greater, we won't upgrade it or re-hash it
int currentWorkFactor = 0;
try try
{ {
int currentWorkFactor = Int32.Parse((this.Password.Split('$')[2])); currentWorkFactor = Int32.Parse((this.Password.Split('$')[2]));
} }
catch (FormatException) catch (FormatException)
{ {
TShock.Log.ConsoleError("Warning: Not upgrading work factor because bcrypt hash in an invalid format."); TShock.Log.ConsoleError("Warning: Not upgrading work factor because bcrypt hash in an invalid format.");
return;
} }
if (currentWorkFactor < TShock.Config.BCryptWorkFactor) if (currentWorkFactor < TShock.Config.BCryptWorkFactor)
@ -510,7 +512,7 @@ namespace TShockAPI.DB
{ {
if (string.IsNullOrEmpty(password) || password == "non-existant password") if (string.IsNullOrEmpty(password) || password == "non-existant password")
return null; return null;
return hashPassword(Encoding.UTF8.GetBytes(password)); return HashPassword(Encoding.UTF8.GetBytes(password));
} }
} }