mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Adding a LoggingIn method to IUserEventHandler
This commit is contained in:
@@ -51,6 +51,17 @@ namespace Orchard.Users.Activities {
|
||||
}
|
||||
}
|
||||
|
||||
[OrchardFeature("Orchard.Users.Workflows")]
|
||||
public class UserLoggingInActivity : UserActivity {
|
||||
public override string Name {
|
||||
get { return "UserLoggingIn"; }
|
||||
}
|
||||
|
||||
public override LocalizedString Description {
|
||||
get { return T("User is logging in."); }
|
||||
}
|
||||
}
|
||||
|
||||
[OrchardFeature("Orchard.Users.Workflows")]
|
||||
public class UserLoggedInActivity : UserActivity {
|
||||
public override string Name {
|
||||
|
@@ -78,6 +78,8 @@ namespace Orchard.Users.Controllers {
|
||||
[SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings",
|
||||
Justification = "Needs to take same parameter type as Controller.Redirect()")]
|
||||
public ActionResult LogOn(string userNameOrEmail, string password, string returnUrl, bool rememberMe = false) {
|
||||
_userEventHandler.LoggingIn(userNameOrEmail, password);
|
||||
|
||||
var user = ValidateLogOn(userNameOrEmail, password);
|
||||
if (!ModelState.IsValid) {
|
||||
var shape = _orchardServices.New.LogOn().Title(T("Log On").Text);
|
||||
|
@@ -13,6 +13,11 @@ namespace Orchard.Users.Events {
|
||||
/// </summary>
|
||||
void Created(UserContext context);
|
||||
|
||||
/// <summary>
|
||||
/// Called before a user has logged in
|
||||
/// </summary>
|
||||
void LoggingIn(string userNameOrEmail, string password);
|
||||
|
||||
/// <summary>
|
||||
/// Called after a user has logged in
|
||||
/// </summary>
|
||||
|
@@ -24,6 +24,12 @@ namespace Orchard.Users.Handlers {
|
||||
() => new Dictionary<string, object> {{"User", context}});
|
||||
}
|
||||
|
||||
public void LoggingIn(string userNameOrEmail, string password) {
|
||||
_workflowManager.TriggerEvent("UserLoggingIn",
|
||||
null,
|
||||
() => new Dictionary<string, object>{{"UserNameOrEmail", userNameOrEmail}, {"Password", password}});
|
||||
}
|
||||
|
||||
public void LoggedIn(Security.IUser user) {
|
||||
_workflowManager.TriggerEvent("UserLoggedIn",
|
||||
user,
|
||||
|
Reference in New Issue
Block a user