Adding LoginFailed event. [Core Module Change]

This commit is contained in:
sfmskywalker
2014-06-02 22:29:34 +02:00
parent 7c1c64eb90
commit de90b60603
3 changed files with 12 additions and 0 deletions

View File

@@ -346,6 +346,7 @@ namespace Orchard.Users.Controllers {
var user = _membershipService.ValidateUser(userNameOrEmail, password); var user = _membershipService.ValidateUser(userNameOrEmail, password);
if (user == null) { if (user == null) {
_userEventHandler.LogInFailed(userNameOrEmail, password);
ModelState.AddModelError("_FORM", T("The username or e-mail or password provided is incorrect.")); ModelState.AddModelError("_FORM", T("The username or e-mail or password provided is incorrect."));
} }

View File

@@ -23,6 +23,11 @@ namespace Orchard.Users.Events {
/// </summary> /// </summary>
void LoggedIn(IUser user); void LoggedIn(IUser user);
/// <summary>
/// Called when a login attempt failed
/// </summary>
void LogInFailed(string userNameOrEmail, string password);
/// <summary> /// <summary>
/// Called when a user explicitly logs out (as opposed to one whose session cookie simply expires) /// Called when a user explicitly logs out (as opposed to one whose session cookie simply expires)
/// </summary> /// </summary>

View File

@@ -36,6 +36,12 @@ namespace Orchard.Users.Handlers {
() => new Dictionary<string, object> {{"User", user}}); () => new Dictionary<string, object> {{"User", user}});
} }
public void LogInFailed(string userNameOrEmail, string password) {
_workflowManager.TriggerEvent("UserLogInFailed",
null,
() => new Dictionary<string, object> { { "UserNameOrEmail", userNameOrEmail }, { "Password", password } });
}
public void LoggedOut(Security.IUser user) { public void LoggedOut(Security.IUser user) {
_workflowManager.TriggerEvent("UserLoggedOut", _workflowManager.TriggerEvent("UserLoggedOut",
user, user,