Beispiel #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (this.txtPwd.Text != "" && this.txtNewPwd.Text != "" && this.txtRepeatPwd.Text != "")
            {
                int id = SessionBox.GetUserSession().UserId;

                ESMonitor.BLL.Users bll = new ESMonitor.BLL.Users();

                if (bll.VerifyPassword(id, Web.Common.Utility.MD5(this.txtPwd.Text.Trim().ToLower(), 32)))
                {
                    //两次密码必须输入必须相同
                    if (String.Compare(this.txtNewPwd.Text.Trim(), this.txtRepeatPwd.Text.Trim(), true) == 0)
                    {
                        if (bll.ChangePassword(id, Web.Common.Utility.MD5(this.txtRepeatPwd.Text.Trim().ToLower(), 32)))
                        {
                            //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>window.parent.zAlert(\"密码修改成功!\",\"1500\");</script>");
                        }
                        else
                        {
                            //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>window.parent.zAlert(\"密码修改失败!\",\"1500\");</script>");
                        }
                    }
                    else
                    {
                        this.lbNewPwd.Text = "确认密码与新密码不同";
                    }
                }
                else
                {
                    this.lbPwd.Text = "原密码错误";
                }
            }
        }
Beispiel #2
0
        protected void UserLogin()
        {
            bool   flag     = false;
            string username = Request.Form["username"].ToString();
            string pwd      = Request.Form["pwd"].ToString();

            pwd = Utility.MD5(pwd.ToLower(), 32);
            string verifycode = Request.Form["verify"].ToString();

            if (Request.Cookies["VerifyCode"] == null)
            {
                //lblMsg.Text = "您的浏览器设置已被禁用 Cookies,您必须设置浏览器允许使用 Cookies 选项后才能使用本系统";
            }
            //验证码是否证确
            else if (String.Compare(Request.Cookies["VerifyCode"].Value, verifycode.ToUpper(), true) == 0)
            {
                ESMonitor.BLL.Users   bll   = new ESMonitor.BLL.Users();
                ESMonitor.Model.Users model = new ESMonitor.Model.Users();
                if (bll.Exists(username))
                {
                    if (bll.CheckLogin(username, pwd))
                    {
                        model = bll.GetModel(username);
                        bll.UpdateLastTime(model.UserId);
                        if (model.Status == 2)
                        {
                            SessionBox.CreateUserSession(new UserSession(model.UserId, model.UserName, model.RoleId, model.ReMark));
                            Response.Redirect("home.aspx?cityId=" + model.ReMark);
                            flag = true;
                        }
                    }
                }
            }

            if (!flag)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>failure();</script>");
            }
        }
Beispiel #3
0
        private void InitUserTree()
        {
            StringBuilder sb = new StringBuilder();

            ESMonitor.BLL.Users bll  = new ESMonitor.BLL.Users();
            List <string>       list = bll.GetUsesList("");

            sb.Append("[");
            foreach (string str in list)
            {
                string[] s = str.Split(',');

                sb.AppendFormat("{0}id:{1},pId:0,name:\"{2}\",checked:true{3},", "{", s[0], s[1], "}");
            }

            if (sb.Length > 1)
            {
                sb = sb.Remove(sb.Length - 1, 1);
            }

            sb.Append("]");

            zUserNodeStr = sb.ToString();
        }
Beispiel #4
0
        private int AddAuths(HttpContext context)
        {
            string areas       = string.Empty;
            string logicGroups = string.Empty;
            string ledCtrls    = string.Empty;
            string cmds        = string.Empty;
            string users       = string.Empty;

            if ((context.Request.Form["area"] == null) ||
                (context.Request.Form["logicGroup"] == null) ||
                (context.Request.Form["ledCtrl"] == null) ||
                (context.Request.Form["cmd"] == null) ||
                (context.Request.Form["user"] == null))
            {
                return(-1);
            }

            areas       = context.Request.Form["area"];
            logicGroups = context.Request.Form["logicGroup"];
            ledCtrls    = context.Request.Form["ledCtrl"];
            cmds        = context.Request.Form["cmd"];
            users       = context.Request.Form["user"];

            string[] user = users.Split(',');

            string[] area       = areas.Split(',');
            string[] logicGroup = logicGroups.Split(',');
            string[] ledCtrl    = ledCtrls.Split(',');
            string[] cmd        = cmds.Split(',');

            List <int>    userList = new List <int>();
            List <string> authList = new List <string>();

            foreach (string u in user)
            {
                userList.Add(int.Parse(u));
            }

            foreach (string a in area)
            {
                authList.Add(a + ",2");
            }

            foreach (string g in logicGroup)
            {
                authList.Add(g + ",3");
            }

            foreach (string l in ledCtrl)
            {
                authList.Add(l + ",4");
            }

            foreach (string c in cmd)
            {
                authList.Add(c + ",5");
            }

            ESMonitor.BLL.Users bll = new ESMonitor.BLL.Users();

            if (bll.AddAuths(userList, authList))
            {
                return(0);
            }

            return(1);
        }
Beispiel #5
0
        protected void OnRegister()
        {
            string username   = Request.Form["txtUserName"].Trim();
            string pwd        = Request.Form["txtPwd"].Trim();
            string repwd      = Request.Form["txtConfirmPwd"].Trim();
            string email      = Request.Form["txtEmail"].Trim();
            string mobile     = Request.Form["txtPhone"].Trim();
            string verifycode = Request.Form["txtValidateCode"].Trim();
            string remark     = Request.Form["txtCountry"].Trim();

            if (Request.Cookies["VerifyCode"] == null)
            {
                //lblMsg.Text = "您的浏览器设置已被禁用 Cookies,您必须设置浏览器允许使用 Cookies 选项后才能使用本系统";
            }
            //验证码是否证确
            else if (String.Compare(Request.Cookies["VerifyCode"].Value, verifycode.ToUpper(), true) == 0)
            {
                if (username != "" && pwd != "" && repwd != "" && email != "" && verifycode != "")
                {
                    //两次密码必须输入必须相同
                    if (String.Compare(pwd, repwd, true) == 0)
                    {
                        ESMonitor.BLL.Users   bll   = new ESMonitor.BLL.Users();
                        ESMonitor.Model.Users model = new ESMonitor.Model.Users();

                        if (!bll.Exists(username))//用户不存在
                        {
                            model.UserName = username;
                            model.Pwd      = Utility.MD5(pwd.ToLower(), 32);
                            model.Email    = email;
                            model.Mobile   = mobile;
                            model.NowTime  = DateTime.Now;
                            model.RoleId   = 2; //普通会员
                            model.Status   = 1; //待审核
                            model.ReMark   = remark;

                            int n = bll.Add(model);

                            if (n >= 1)
                            {
                                Response.Redirect("home.aspx?cityId=" + remark);
                            }
                            else
                            {
                                //this.ltlName.Text = "注册失败";
                            }
                        }
                        else
                        {
                            //this.ltlName.Text = "用户名已使用";
                        }
                    }
                    else
                    {
                    }
                    //lblMsg.Text = "两次密码不一致";
                }
            }
            else
            {
                //lblMsg.Text = "验证码错误";
            }
        }