mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Merge
This commit is contained in:
@@ -9,6 +9,7 @@ namespace Orchard.Users.Models {
|
|||||||
|
|
||||||
public virtual string Password { get; set; }
|
public virtual string Password { get; set; }
|
||||||
public virtual MembershipPasswordFormat PasswordFormat { get; set; }
|
public virtual MembershipPasswordFormat PasswordFormat { get; set; }
|
||||||
|
public virtual string HashAlgorithm { get; set; }
|
||||||
public virtual string PasswordSalt { get; set; }
|
public virtual string PasswordSalt { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,6 +39,7 @@ namespace Orchard.Users.Services {
|
|||||||
init.Record.UserName = createUserParams.Username;
|
init.Record.UserName = createUserParams.Username;
|
||||||
init.Record.Email = createUserParams.Email;
|
init.Record.Email = createUserParams.Email;
|
||||||
init.Record.NormalizedUserName = createUserParams.Username.ToLower();
|
init.Record.NormalizedUserName = createUserParams.Username.ToLower();
|
||||||
|
init.Record.HashAlgorithm = "SHA1";
|
||||||
SetPassword(init.Record, createUserParams.Password);
|
SetPassword(init.Record, createUserParams.Password);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -128,7 +129,7 @@ namespace Orchard.Users.Services {
|
|||||||
|
|
||||||
var combinedBytes = saltBytes.Concat(passwordBytes).ToArray();
|
var combinedBytes = saltBytes.Concat(passwordBytes).ToArray();
|
||||||
|
|
||||||
var hashAlgorithm = HashAlgorithm.Create("SHA1");
|
var hashAlgorithm = HashAlgorithm.Create(record.HashAlgorithm);
|
||||||
var hashBytes = hashAlgorithm.ComputeHash(combinedBytes);
|
var hashBytes = hashAlgorithm.ComputeHash(combinedBytes);
|
||||||
|
|
||||||
record.PasswordFormat = MembershipPasswordFormat.Hashed;
|
record.PasswordFormat = MembershipPasswordFormat.Hashed;
|
||||||
@@ -144,7 +145,7 @@ namespace Orchard.Users.Services {
|
|||||||
|
|
||||||
var combinedBytes = saltBytes.Concat(passwordBytes).ToArray();
|
var combinedBytes = saltBytes.Concat(passwordBytes).ToArray();
|
||||||
|
|
||||||
var hashAlgorithm = HashAlgorithm.Create("SHA1");
|
var hashAlgorithm = HashAlgorithm.Create(record.HashAlgorithm);
|
||||||
var hashBytes = hashAlgorithm.ComputeHash(combinedBytes);
|
var hashBytes = hashAlgorithm.ComputeHash(combinedBytes);
|
||||||
|
|
||||||
return record.Password == Convert.ToBase64String(hashBytes);
|
return record.Password == Convert.ToBase64String(hashBytes);
|
||||||
|
|||||||
Reference in New Issue
Block a user