public async Task <IHttpActionResult> RequestPasswordReset([FromBody] string email) { _logger.Debug(string.Format("Begin. Email: [{0}]", email)); var user = await NdUserManager.FindByEmailAsync(email); if (user == null) { _logger.Debug(string.Format("User was not found. Email: [{0}]", email)); return(NotFound()); } try { string code = await NdUserManager.GeneratePasswordResetTokenAsync(user.Id); var callbackUrl = new Uri(Url.Link("ResetPasswordRoute", new { userId = user.Id, code = code })); await NdUserManager.SendEmailAsync(user.Id, "Reset Password", NdEmailService.CreateResetPasswordBody(callbackUrl.ToString())); } catch (Exception ex) { _logger.Error(string.Format("Error sending ResetPassword email for user. Email: [{0}]", email), ex); return(InternalServerError(ex)); } _logger.Debug(string.Format("Reset password email sent succeessfully. Email: [{0}]", email)); return(Ok()); }