public ActionResult change() { string username = Request["a"]; string pass = Request["b"]; string newpass = Request["c"]; string repass = Request["d"]; string oldpass = ((Account)System.Web.HttpContext.Current.Session["login1"]).Pass; if (pass.Equals(oldpass) == false) { Session["Err"] = "Pass nhập bị sai (không giống pass cũ)"; return(Redirect("/User/ChangePass")); } else if (newpass.Equals(repass) == false) { Session["Err"] = "kiểm tra lại new pass và repass phải giống nhau"; return(Redirect("/User/ChangePass")); } else { Session["Err"] = "ok rồi đấy"; DBIO d = new DBIO(); d.Changepass(username, newpass); Session.Abandon(); return(Redirect("/Home/Index")); } }
public ActionResult ProfilePage() { DBIO d = new DBIO(); string username = ((Account)System.Web.HttpContext.Current.Session["login1"]).Username; Account a = d.checkaccount(username); string pass = Request["old"]; string newpass = Request["new"]; string repass = Request["renew"]; string oldpass = ((Account)System.Web.HttpContext.Current.Session["login1"]).Pass; if (pass == null || newpass == null || repass == null) { ViewBag.mess = "Chú Ý phải điền đầy đủ tất cả mấy cái text box kia"; return(View(a)); } else { if (pass.Equals(oldpass) == false) { ViewBag.mess = "Nhập Mật Khẩu cũ bị sai"; return(View(a)); } else if (newpass.Equals(repass) == false) { ViewBag.mess = "Re-password và password Không khớp nhau"; return(View(a)); } else { d.Changepass(username, newpass); Session.Abandon(); return(Redirect("/ADControl/AdminHomePage")); } } }