This commit is contained in:
Suha Can
2010-06-04 12:35:16 -07:00
2 changed files with 4 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ namespace Orchard.Users.Models {
public virtual string Password { get; set; }
public virtual MembershipPasswordFormat PasswordFormat { get; set; }
public virtual string HashAlgorithm { get; set; }
public virtual string PasswordSalt { get; set; }
}
}

View File

@@ -39,6 +39,7 @@ namespace Orchard.Users.Services {
init.Record.UserName = createUserParams.Username;
init.Record.Email = createUserParams.Email;
init.Record.NormalizedUserName = createUserParams.Username.ToLower();
init.Record.HashAlgorithm = "SHA1";
SetPassword(init.Record, createUserParams.Password);
});
}
@@ -128,7 +129,7 @@ namespace Orchard.Users.Services {
var combinedBytes = saltBytes.Concat(passwordBytes).ToArray();
var hashAlgorithm = HashAlgorithm.Create("SHA1");
var hashAlgorithm = HashAlgorithm.Create(record.HashAlgorithm);
var hashBytes = hashAlgorithm.ComputeHash(combinedBytes);
record.PasswordFormat = MembershipPasswordFormat.Hashed;
@@ -144,7 +145,7 @@ namespace Orchard.Users.Services {
var combinedBytes = saltBytes.Concat(passwordBytes).ToArray();
var hashAlgorithm = HashAlgorithm.Create("SHA1");
var hashAlgorithm = HashAlgorithm.Create(record.HashAlgorithm);
var hashBytes = hashAlgorithm.ComputeHash(combinedBytes);
return record.Password == Convert.ToBase64String(hashBytes);