コード例 #1
0
        protected void btnChangePwd_Click(object sender, EventArgs e)
        {
            btnChangePwd.Enabled = false;
            //更改密码首先验证原始密码,
            //然后在保存用户的新密码
            AdminUser user = Session["Users"] as AdminUser;

            if (user != null && AdminUserBLL.CheckAdminUser(user.UserID, MD5PWD.EnCode(oldpwd.Text)))
            {
                //验证旧的密码成功

                if (new AdminUserBLL().SavaNewPwd(user.ID.ToString(), MD5PWD.EnCode(newpwd.Text)) > 0)
                {
                    JqHelper.ResponseScript("alert(\"修改密码成功!\")");
                }
                else
                {
                    JqHelper.ResponseScript("alert(\"修改密码失败!\")");
                }
            }
            btnChangePwd.Enabled = true;
        }
コード例 #2
0
 protected void button_login_Click(object sender, EventArgs e)
 {
     //添加必填验证
     if (CheckInput())
     {
         button_login.Enabled = false;
         if (AdminUserBLL.CheckAdminUser(textbox_userId.Text, MD5PWD.EnCode(textbox_pwd.Text)))
         {
             AdminUser admin = new AdminUser();
             admin.UserID  = textbox_userId.Text;
             admin.UserPwd = MD5PWD.EnCode(textbox_pwd.Text);
             //登录按钮操作事件
             //Session["pwd"] = textbox_pwd.Text;
             admin            = new AdminUserBLL().GetByID(textbox_userId.Text);
             Session["Users"] = admin;//将用户存入到Session中
             Response.Redirect("../AdminManagerment/Index.aspx");
         }
         else
         {
             JqHelper.ResponseScript("alert(\"登录密码或用户名错误!\")");
             button_login.Enabled = true;
         }
     }
 }