public ActionResult ForgetPasswordDone(ForgetPasswordModel model) { return View(model); }
public ActionResult ForgetPassword(ForgetPasswordModel model, string returnUrl) { if (ModelState.IsValid) { var username = Membership.GetUserNameByEmail(model.Email); if (!string.IsNullOrEmpty(username)) { var user = Membership.GetUser(username, false); if (user.Email == model.Email) { EmailAdmin.SendResetPasswordLink(user.Email, user.UserName, ResetPasswordModel.CookResetHash(user.UserName)); if (!String.IsNullOrEmpty(returnUrl)) { return Redirect(returnUrl); } else { return RedirectToAction("ForgetPasswordDone", model); } } else { ModelState.AddModelError("", "用户名与邮箱地址不匹配。"); } } else { ModelState.AddModelError("", "用户名不存在。"); } } // If we got this far, something failed, redisplay form return View(model); }