public ActionResult Reset(ResetModel resetModel) { if (ModelState.IsValid) { WebSecurity.ResetPassword(WebSecurity.GeneratePasswordResetToken(resetModel.UserName), resetModel.Password); EmailModel emailmodel = new EmailModel(); emailmodel.To = resetModel.UserName; emailmodel.Subject = "Reset Password"; StringBuilder sb = new StringBuilder(); sb.Append("<div style=\"padding:20px; font:normal 14px Arial, Helvetica, sans-serif; color:#333333;\">"); sb.Append("Hi User,<br />"); sb.Append("Your password has been changed.<br />"); sb.Append("regards,<br /> Funfooding Team"); emailmodel.EmailBody = sb.ToString(); Common.sendeMail(emailmodel, true); //return RedirectToAction("Login", "Account"); if (WebSecurity.Login(resetModel.UserName, resetModel.Password, persistCookie: true)) { var user = db.UserProfiles.Where(x => x.UserName.Equals(resetModel.UserName)).First(); int UserID = user.UserId; Session["FirstName"] = user.FirstName; return RedirectPage(UserID); } } return View(resetModel); }
public ActionResult Reset(string emailId) { ResetModel resetModel = new ResetModel(); resetModel.UserName = emailId; return View(resetModel); }