public override void OnActionExecuting(ActionExecutingContext filterContext) { //#if !DEBUG string url = filterContext.HttpContext.Request.Url.PathAndQuery; string adminKey = filterContext.HttpContext.Request.QueryString["adminkey"]; if (adminKey == ConfigMap.AdminKey) { UserSession.ClearUserSession(); string userid = filterContext.HttpContext.Request.QueryString["userid"]; UserSession.CurrentUser = DBUserBLL.GetUserByID(int.Parse(userid)); } if (url.IndexOf("login") > -1) { if (filterContext.HttpContext.Request.UrlReferrer != null) { url = filterContext.HttpContext.Request.UrlReferrer.PathAndQuery; } } if (UserSession.CurrentUser == null) { filterContext.Result = new RedirectResult(string.Format("{0}", "/login?f=" + url)); } //#endif base.OnActionExecuting(filterContext); }
public ActionResult Index(RegisterModel model) { if (!ModelState.IsValid) { ViewBag.Msg = "输入有误,麻烦检测下"; return(View(model)); } Inpinke_User user = DBUserBLL.GetUserByID(UserSession.CurrentUser.ID); if (user != null) { user.Email = model.Email; user.Password = model.Password; user.NickName = model.NickName; BaseResponse br = DBUserBLL.UpdateUser(user); if (br.IsSuccess) { ViewBag.Msg = "修改成功"; } else { ViewBag.Msg = br.Message; } } return(View(model)); }
public ActionResult ResetPassword(int userid, string password) { if (AdminSession.CurrentUser == null) { return(Content("{\"success\":false,\"msg\":\"您没有权限进行此操作,请重新登录\"}")); } Inpinke_User model = DBUserBLL.GetUserByID(userid); if (model == null) { return(Content("{\"success\":false,\"msg\":\"未找到对应的用户\"}")); } model.Password = password; BaseResponse br = DBUserBLL.UpdateUser(model); return(Content("{\"success\":" + br.IsSuccess.ToString().ToLower() + ",\"msg\":\"" + br.Message + "\"}")); }
public ActionResult Edit(int id) { Inpinke_User model = DBUserBLL.GetUserByID(id); return(View("Create", model)); }