mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -26,10 +26,7 @@ namespace Orchard.Tests.Modules.Settings.Blueprint {
|
|||||||
public string LastMessageName { get; set; }
|
public string LastMessageName { get; set; }
|
||||||
public IDictionary<string, object> LastEventData { get; set; }
|
public IDictionary<string, object> LastEventData { get; set; }
|
||||||
|
|
||||||
public void Notify_Obsolete(string messageName, IDictionary<string, string> eventData) {
|
public IEnumerable Notify(string messageName, IDictionary<string, object> eventData) {
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable Notify(string messageName, Dictionary<string, object> eventData) {
|
|
||||||
LastMessageName = messageName;
|
LastMessageName = messageName;
|
||||||
LastEventData = eventData;
|
LastEventData = eventData;
|
||||||
return new object[0];
|
return new object[0];
|
||||||
|
@@ -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);
|
||||||
|
@@ -172,9 +172,10 @@ caption { background: #eee; }
|
|||||||
|
|
||||||
-------------------------------------------------------------- */
|
-------------------------------------------------------------- */
|
||||||
|
|
||||||
label { font-weight: normal; }
|
label { font-weight: normal; display:block; }
|
||||||
fieldset { padding:0em; margin: 0 0 0em 0; border: 0px solid #ccc; }
|
label.forcheckbox { margin:0 0 0 4px; display:inline; }
|
||||||
legend { font-weight: bold; font-size:1.2em; }
|
fieldset { padding:0em; margin: 0 0 0em 0; border: 0px solid #ccc; }
|
||||||
|
legend { font-weight: bold; font-size:1.2em; }
|
||||||
|
|
||||||
|
|
||||||
/* Form fields
|
/* Form fields
|
||||||
|
@@ -9,7 +9,7 @@ using (Html.BeginFormAntiForgeryPost(Url.Action("LogOn", new {ReturnUrl = Reques
|
|||||||
<fieldset class="login-form">
|
<fieldset class="login-form">
|
||||||
<legend><%: T("Account Information")%></legend>
|
<legend><%: T("Account Information")%></legend>
|
||||||
<div class="group">
|
<div class="group">
|
||||||
<label for="username"><%: T("Username:")%></label>
|
<label for="userNameOrEmail"><%: T("Username:")%></label>
|
||||||
<%: Html.TextBox("userNameOrEmail", "", new { autofocus = "autofocus" })%>
|
<%: Html.TextBox("userNameOrEmail", "", new { autofocus = "autofocus" })%>
|
||||||
<%: Html.ValidationMessage("userNameOrEmail")%>
|
<%: Html.ValidationMessage("userNameOrEmail")%>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -170,9 +170,10 @@ caption { background: #eee; }
|
|||||||
|
|
||||||
-------------------------------------------------------------- */
|
-------------------------------------------------------------- */
|
||||||
|
|
||||||
label { font-weight: normal; }
|
label { font-weight: normal; display:block; }
|
||||||
fieldset { padding:0em; margin: 0 0 0em 0; border: 0px solid #ccc; }
|
label.forcheckbox { margin:0 0 0 4px; display:inline; }
|
||||||
legend { font-weight: bold; font-size:1.2em; }
|
fieldset { padding:0em; margin: 0 0 0em 0; border: 0px solid #ccc; }
|
||||||
|
legend { font-weight: bold; font-size:1.2em; }
|
||||||
|
|
||||||
|
|
||||||
/* Form fields
|
/* Form fields
|
||||||
|
@@ -9,7 +9,7 @@ using (Html.BeginFormAntiForgeryPost(Url.Action("LogOn", new {ReturnUrl = Reques
|
|||||||
<fieldset class="login-form">
|
<fieldset class="login-form">
|
||||||
<legend><%: T("Account Information")%></legend>
|
<legend><%: T("Account Information")%></legend>
|
||||||
<div class="group">
|
<div class="group">
|
||||||
<label for="username"><%: T("Username:")%></label>
|
<label for="userNameOrEmail"><%: T("Username:")%></label>
|
||||||
<%: Html.TextBox("userNameOrEmail", "", new { autofocus = "autofocus" })%>
|
<%: Html.TextBox("userNameOrEmail", "", new { autofocus = "autofocus" })%>
|
||||||
<%: Html.ValidationMessage("userNameOrEmail")%>
|
<%: Html.ValidationMessage("userNameOrEmail")%>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -20,12 +20,12 @@ namespace Orchard.Events {
|
|||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public IEnumerable Notify(string messageName, Dictionary<string, object> eventData) {
|
public IEnumerable Notify(string messageName, IDictionary<string, object> eventData) {
|
||||||
// call ToArray to ensure evaluation has taken place
|
// call ToArray to ensure evaluation has taken place
|
||||||
return NotifyHandlers(messageName, eventData).ToArray();
|
return NotifyHandlers(messageName, eventData).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<object> NotifyHandlers(string messageName, Dictionary<string, object> eventData) {
|
private IEnumerable<object> NotifyHandlers(string messageName, IDictionary<string, object> eventData) {
|
||||||
string[] parameters = messageName.Split('.');
|
string[] parameters = messageName.Split('.');
|
||||||
if (parameters.Length != 2) {
|
if (parameters.Length != 2) {
|
||||||
throw new ArgumentException(messageName + T(" is not formatted correctly"));
|
throw new ArgumentException(messageName + T(" is not formatted correctly"));
|
||||||
@@ -46,7 +46,7 @@ namespace Orchard.Events {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TryNotifyHandler(IEventHandler eventHandler, string messageName, string interfaceName, string methodName, Dictionary<string, object> eventData, out IEnumerable returnValue) {
|
private bool TryNotifyHandler(IEventHandler eventHandler, string messageName, string interfaceName, string methodName, IDictionary<string, object> eventData, out IEnumerable returnValue) {
|
||||||
try {
|
try {
|
||||||
return TryInvoke(eventHandler, interfaceName, methodName, eventData, out returnValue);
|
return TryInvoke(eventHandler, interfaceName, methodName, eventData, out returnValue);
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,6 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace Orchard.Events {
|
namespace Orchard.Events {
|
||||||
public interface IEventBus : IDependency {
|
public interface IEventBus : IDependency {
|
||||||
IEnumerable Notify(string messageName, Dictionary<string, object> eventData);
|
IEnumerable Notify(string messageName, IDictionary<string, object> eventData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user