Adds forgot password events
This commit is contained in:
@@ -56,6 +56,8 @@ namespace Umbraco.Core.Auditing
|
||||
{
|
||||
AccountLocked,
|
||||
AccountUnlocked,
|
||||
ForgotPasswordRequested,
|
||||
ForgotPasswordChangedSuccess,
|
||||
LoginFailed,
|
||||
LoginRequiresVerification,
|
||||
LoginSucces,
|
||||
|
||||
@@ -370,6 +370,22 @@ namespace Umbraco.Core.Security
|
||||
});
|
||||
}
|
||||
|
||||
internal void RaiseForgotPasswordRequestedEvent(int userId)
|
||||
{
|
||||
OnForgotPasswordRequested(new IdentityAuditEventArgs(AuditEvent.ForgotPasswordRequested)
|
||||
{
|
||||
AffectedUser = userId
|
||||
});
|
||||
}
|
||||
|
||||
internal void RaiseForgotPasswordChangedSuccessEvent(int userId)
|
||||
{
|
||||
OnForgotPasswordChangedSuccess(new IdentityAuditEventArgs(AuditEvent.ForgotPasswordChangedSuccess)
|
||||
{
|
||||
AffectedUser = userId
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears a lock so that the membership user can be validated.
|
||||
/// </summary>
|
||||
@@ -404,6 +420,8 @@ namespace Umbraco.Core.Security
|
||||
|
||||
public static event EventHandler AccountLocked;
|
||||
public static event EventHandler AccountUnlocked;
|
||||
public static event EventHandler ForgotPasswordRequested;
|
||||
public static event EventHandler ForgotPasswordChangedSuccess;
|
||||
public static event EventHandler LoginFailed;
|
||||
public static event EventHandler LoginRequiresVerification;
|
||||
public static event EventHandler LoginSuccess;
|
||||
@@ -422,6 +440,16 @@ namespace Umbraco.Core.Security
|
||||
if (AccountUnlocked != null) AccountUnlocked(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnForgotPasswordRequested(IdentityAuditEventArgs e)
|
||||
{
|
||||
if (ForgotPasswordRequested != null) ForgotPasswordRequested(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnForgotPasswordChangedSuccess(IdentityAuditEventArgs e)
|
||||
{
|
||||
if (ForgotPasswordChangedSuccess != null) ForgotPasswordChangedSuccess(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnLoginFailed(IdentityAuditEventArgs e)
|
||||
{
|
||||
if (LoginFailed != null) LoginFailed(this, e);
|
||||
|
||||
@@ -225,7 +225,9 @@ namespace Umbraco.Web.Editors
|
||||
Services.TextService.Localize("login/resetPasswordEmailCopySubject",
|
||||
//Ensure the culture of the found user is used for the email!
|
||||
UserExtensions.GetUserCulture(identityUser.Culture, Services.TextService)),
|
||||
message);
|
||||
message);
|
||||
|
||||
_userManager.RaiseForgotPasswordRequestedEvent(user.Id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,7 +334,8 @@ namespace Umbraco.Web.Editors
|
||||
() => model.UserId, () => unlockResult.Errors.First());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_userManager.RaiseForgotPasswordChangedSuccessEvent(model.UserId);
|
||||
return Request.CreateResponse(HttpStatusCode.OK);
|
||||
}
|
||||
return Request.CreateValidationErrorResponse(
|
||||
|
||||
Reference in New Issue
Block a user