Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added log information when a password reset. #475

Merged
merged 1 commit into from Apr 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -127,14 +127,16 @@ public async Task<IActionResult> ForgotPassword(ForgotPasswordViewModel model)
if (user == null || !(await _userManager.IsEmailConfirmedAsync(user)))
{
// Don't reveal that the user does not exist or is not confirmed
_logger.LogWarning("ForgotPassword - " +model.Email + " User does not exist or is not confirmed");
return View("ForgotPasswordConfirmation");
}

// For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713
// Send an email with this link
var passwordResetToken = await _userManager.GeneratePasswordResetTokenAsync(user);
var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.BusinessPartnerId, code = passwordResetToken }, protocol: HttpContext.Request.Scheme);
_mailService.SendPasswordResetToken( user, passwordResetToken, 24 );
_mailService.SendPasswordResetToken( user, passwordResetToken, 24 );
_logger.LogInformation("ForgotPassword - " + model.Email + " Mail was sent.");
return View("ForgotPasswordConfirmation");
}

Expand Down Expand Up @@ -300,6 +302,11 @@ public IActionResult ResetPassword(string code = null, string mail = null)
_logger.LogWarning($"Code supplied to {nameof(ResetPassword)} was null");
return View("Error");
}
else if (mail == null)
{
_logger.LogWarning($"mail supplied to {nameof(ResetPassword)} was null");
return View("Error");
}
else
{
var model = new ResetPasswordViewModel
Expand Down