public async Task <IActionResult> ForgotPassword([FromBody] ForgotPasswordModel request) { var user = await _userManager.FindByEmailAsync(request.Email); // || (await _userManager.IsEmailConfirmedAsync(user) if (user is null) { return(BadRequest("Account does not exist")); } string token = await _userManager.GeneratePasswordResetTokenAsync(user); var callbackUrl = _urlHelper.Action( controller: "ForgotPassword", action: "ResetPassword", values: new { email = user.Email, token }, protocol: _httpContextAccessor.HttpContext.Request.Scheme, host: "localhost:5001" ); await _mailer.SenEmailAsync(user.Email, "Reset Password", callbackUrl); return(Ok(token)); }