Пример #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        dbModule dm = new dbModule();
        pbModule pm = new pbModule();
        string oldpass = oldpassTextbox.Text.Trim();
        string newpass1 = newpassTextbox1.Text.Trim();
        string newpass2 = newpassTextbox2.Text.Trim();
        if ( !pm.isValidString( oldpass) || !pm.isValidString( newpass1 )||!pm.isValidString(newpass2) )
        {
            errors.Text = Resources.Resource.strNotValidString;
            return;
        }

        if (pm.isNullString(newpass1))
        {
            errors.Text = "";
        }
        Security s1 = Session["sec"] as Security;
        if (s1 == null)
        {
            errors.Text = "sorry";
            return;
        }
        string username = s1.getUserCode();
        if (dm.aadmLogin ( username , oldpass )==1)
        {
            if (newpass1==newpass2)
            {
                String sqlstr = "update t_glyxxb set dlmm='" + newpass1 + "' where dlm='" + username + "'";
                if (dm.updatePasswd(sqlstr)==1)
                    Response.Write("密码修改成功");
                else
                    Response.Write("密码修改失败");

            }
            else
               Response.Write("两次密码输入不一致");
        }
        else
            Response.Write("旧密码错误");
    }