private string modifyPsw() { UserInfo user = (UserInfo)Session["user"]; string oldPsw = Request.Form["oldPsw"]; string newPsw = Request.Form["newPsw"]; user.passWord = oldPsw; string token = ""; string res = UserInfoManage.Login(ref user, ref token);//"登录成功" if (res == "登录成功") { user.passWord = newPsw; res = UserInfoManage.ModifyPassword(ref user); //Session["user"] = user; if (res.Contains("操作成功")) { Session["user"] = user; List <DepartmentPost> dpList = UserInfoManage.GetDepartmentPostList(user); Session["DepartmentPostList"] = dpList; res = "密码修改成功!"; } } return(res); }
private void Login() { string userName = Request.Form["user"]; string psw = Request.Form["psw"]; string remerberMe = Request.Form["remerberMe"]; UserInfo user = new UserInfo(); user.userName = userName; user.passWord = psw; user.mobilePhone = userName; string token = ""; string value = UserInfoManage.Login(ref user, ref token); CookieHelper cookie = new CookieHelper(Context); if (value == "登录成功") { Response.Write("T"); Session["user"] = user; List <DepartmentPost> dpList = UserInfoManage.GetDepartmentPostList(user); Session["DepartmentPostList"] = dpList; //把用户名存入cookie cookie.ClearCookie("RememberMe"); cookie.SetCookie("RememberMe", user.userName, DateTime.Now.AddDays(7)); if (remerberMe == "true")//把token存入cookie { cookie.ClearCookie("LoginToken"); cookie.SetCookie("LoginToken", token, DateTime.Now.AddDays(7)); } } else { Response.Write(value); } }