public async Task<ActionResult> ForgotPassword(ForgotPasswordViewModel model) { //SendSmsBusiness objap = new SendSmsBusiness(); RegisterBusiness reg = new RegisterBusiness(); EmailBusiness _emailBusiness = new EmailBusiness(); if (ModelState.IsValid) { ApplicationUser user = new ApplicationUser(); user = reg.UserManager.FindByEmail(model.Email); // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link if (user != null) { string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id); var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol:Request.Url.Scheme); await UserManager.SendEmailAsync(user.Id, "Reset Password", "Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>"); _emailBusiness.SendEmailForgot(model.Email, callbackUrl); return RedirectToAction("ForgotPasswordConfirmation", "Account"); } { ModelState.AddModelError("", "The user does not exist"); return View(); } } // If we got this far, something failed, redisplay form return View(model); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)