/// <summary> /// 改密码页面 /// </summary> /// <returns></returns> public IActionResult ChangePassword() { AdminMethod method = new AdminMethod(); this.Request.Cookies.TryGetValue("Ano", out string value); var Admin = method.GetAdmin(value); ViewBag.Admin = Admin; return(View()); }
/// <summary> /// 检查列表权限 /// </summary> /// <param name="tableName"></param> /// <returns></returns> protected bool CheckListPermission(string tableName) { if (AdminMethod.HasManage("admin") || AdminMethod.HasManage(tableName) || AdminMethod.HasManage("guanli") || AdminMethod.HasManage("cwsh") || AdminMethod.HasManage("caiwu")) { return(true); } else { return(false); } }
protected bool CheckDelPermission(string tableName, int adminID, int state) { //管理员可以删除,用户可以删除自己未审核的单子 if (AdminMethod.HasManage("admin") || AdminMethod.HasManage("tableName")) { return(true); // || AdminMethod.HasManage(tableName) } else if (AdminMethod.AdminID == adminID && state == 0) { return(true); } else { return(false); } }
protected void Page_Load(object sender, EventArgs e) { //Response.Headers.Remove("Server"); GlobalConfig condition = new GlobalConfig(); condition.ID = 1; GlobalConfig global = TableOperate <GlobalConfig> .GetRowData(condition);//对表的操作 if (global.ID > 0) { if (global.UserIP == 1 && !AdminMethod.IsWhite()) { Response.Redirect("/ErrorPage/NOIP.html"); return; } } try { Result result = new Result(); string action = RequestString.NoHTML(Convert.ToString(Request["action"])); if (action == "save") { string isCheck = Convert.ToString(HttpContext.Current.Session["isCheck"]); if (isCheck == "") { Random random = new Random(); result.isOk = false; result.msg = "请先验证验证码!!!" + random.Next(1000); } else { string username = ""; string pass = ""; if (!string.IsNullOrEmpty(Request["username"])) { username = RequestString.NoHTML(Request["username"]); } if (!string.IsNullOrEmpty(Request["usermima"])) { pass = RequestString.NoHTML(Request["usermima"]); } if (username != "" && pass != "") { if (!IsLoginError())//超过三次清空验证码重新验证 { HttpContext.Current.Session["isCheck"] = null; result.isOk = false; result.msg = "错误次数太多请一分钟后重试!!!"; } else { bool IsSuccess = AdminMethod.VerifyPwd(username, pass); if (IsSuccess) { HttpContext.Current.Session["isCheck"] = null; HttpContext.Current.Session["LoginCount"] = null; HttpContext.Current.Session["lastTime"] = null; result.isOk = true; result.url = "index.aspx"; } else { //ClientScript.RegisterStartupScript(GetType(), "message", "<script>layer.msg('账号或密码错误!!!', { offset: 't', anim: 6});</script>"); //return; result.isOk = false; result.msg = "账号或密码错误!!!"; loglock(); } } } } Response.ContentType = "application/json"; Response.Write(JsonConvert.SerializeObject(result)); Response.End(); } else if (action == "loginout") { AdminMethod.LoginOut(); Response.Redirect("login.aspx"); } else { HttpContext.Current.Session["LoginCount"] = null; HttpContext.Current.Session["lastTime"] = null; HttpContext.Current.Session["isCheck"] = null; } } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { m_ExhibitionList = ExhibitionProvider.SelectAll(); string action = GetstringKey("action"); if (action != "save") { if (!string.IsNullOrEmpty(this.Request["iD"])) { MyID = Convert.ToInt32(this.Request["iD"]); Admin_User condition = new Admin_User(); if (MyID == -1) { condition.ID = AdminMethod.AdminID; states.Disabled = true; } else { condition.ID = MyID; } news = TableOperate <Admin_User> .GetRowData(condition); iD.Value = Convert.ToString(news.ID); states.Value = Convert.ToString(news.States); } DataBind(); } else { Result result = new Result(); string logbrief = ""; Admin_User newChannelNews = new Admin_User(); newChannelNews.ID = 0; newChannelNews.AutoForm(this.Page); string title = newChannelNews.Name; string headpic = Draw.Drawing(newChannelNews.FullName, newChannelNews.FullName + "_" + newChannelNews.Name + ".png"); newChannelNews.HeadPic = headpic; string pass; if (!string.IsNullOrEmpty(this.Request["pass"])) { pass = Convert.ToString(this.Request["pass"]); pass = Md5JiaMi.JiaMi(pass); // md5加密 } else { pass = Convert.ToString(this.Request["oldpass"]); } newChannelNews.Pass = pass; int _iD; if (!string.IsNullOrEmpty(this.Request["iD"])) { _iD = Convert.ToInt32(this.Request["iD"]); TableOperate <Admin_User> .Update(newChannelNews); result.msg = "编辑成功,等待返回列表"; logbrief = "管理员:【" + AdminMethod.AdminFullName + "】在" + DateTime.Now.GetDateTimeFormats('f')[0].ToString() + "编辑了为【" + title + "】的管理员"; } else { string name = Convert.ToString(Request["name"]); name = RequestString.NoHTML(name); if (AdminMethod.IsName(name)) { result.msg = "用户已存在"; Response.ContentType = "text/json"; Response.Write(new JavaScriptSerializer().Serialize(result)); Response.End(); return; } else { newChannelNews.AddTime = DateTime.Now; newChannelNews.AddID = AdminMethod.AdminID; newChannelNews.LastLoginTime = DateTime.Now; _iD = TableOperate <Admin_User> .InsertReturnID(newChannelNews); result.msg = "添加成功,等待返回列表"; logbrief = "管理员:【" + AdminMethod.AdminFullName + "】在" + DateTime.Now.GetDateTimeFormats('f')[0].ToString() + "添加了为【" + title + "】的管理员"; } } if (_iD > 0) { result.isOk = true; Lognet.AddLogin(logbrief); if ((newChannelNews.Manage != AdminMethod.AdminManages) && AdminMethod.AdminID == newChannelNews.ID) { AdminMethod.UpdataManage(newChannelNews.Manage); } } else { result.msg = "操作失败"; } Response.ContentType = "text/json"; Response.Write(new JavaScriptSerializer().Serialize(result)); Response.End(); } DataBind(); }