public ActionResult ResetPassword(ViewResetPassword resetPassword) { HttpCookie member_cookie = Request.Cookies["member_id"]; tblUser user = db.tblUsers.Find(int.Parse(member_cookie.Value.ToString())); if (ModelState.IsValid) { user.User_Password = resetPassword.NewPassword; db.tblUsers.Find(user.User_ID).User_Password = resetPassword.NewPassword; db.SaveChanges(); Session["member"] = user; Session["notifi_resetpass"] = "******"; return(RedirectToAction("MyInfo")); } return(View(resetPassword)); }
public ActionResult ResetPassword(ViewResetPassword resetPassword) { if (function.CookieID() != null) { return(Redirect("/")); } else if (ModelState.IsValid) { var cookie = function.CookieID(); if (resetPassword.OldPassword == db.Users.Find(cookie.user_id).user_pass) { usersDAO.ResetPassword(cookie.user_id, resetPassword.NewPassword); return(Redirect("/")); } } return(View(resetPassword)); }