protected void btnModifyPwd_Click(object sender, EventArgs e) { //验证用户名与密码是否正确 int ErrorID = 0; string ErrorMsg = ""; DataTable dt = new DataTable(); string strLoginName = Page.User.Identity.Name; string strPassword = txtOldPwd.Text.Trim(); Tz888.BLL.Login.LoginInfoBLL obj = new Tz888.BLL.Login.LoginInfoBLL(); Tz888.SQLServerDAL.LoginInfo.LoginInfo obj2 = new Tz888.SQLServerDAL.LoginInfo.LoginInfo(); dt = obj.Authenticate(strLoginName, 0, strPassword, true, ref ErrorID, ref ErrorMsg); if (dt.Rows.Count > 0) { string strNewPassword = txtNewPwd.Text.Trim(); //修改密码 if (obj2.ChangePassword(strLoginName, strNewPassword)) { Tz888.Common.MessageBox.Show(this.Page, "修改成功!"); } } else { Tz888.Common.MessageBox.Show(this.Page, "您输入的旧密码不正确!"); } }
protected void IbtnSubmit_Click(object sender, ImageClickEventArgs e) { int ErrorID = 0; string ErrorMsg = ""; DataTable dt = new DataTable(); string strLoginName = Page.User.Identity.Name; string strPassword = txtUserPwd.Value.ToString().Trim(); Tz888.BLL.Login.LoginInfoBLL obj = new Tz888.BLL.Login.LoginInfoBLL(); Tz888.SQLServerDAL.LoginInfo.LoginInfo obj2 = new Tz888.SQLServerDAL.LoginInfo.LoginInfo(); List <Tz888.Model.Common.IndustryModel> industryModels = new List <Tz888.Model.Common.IndustryModel>(); //融资行业实体列表 dt = obj.Authenticate(strLoginName, 0, strPassword, true, ref ErrorID, ref ErrorMsg); if (dt.Rows.Count > 0) { industryModels = this.SelectIndustryControl1.IndustryModels; SHA1 sha1 = SHA1.Create(); byte[] passWord2 = sha1.ComputeHash(Encoding.Unicode.GetBytes(this.txtUserPwd.Value.ToString().Trim())); string name = Page.User.Identity.Name; string[] num = member.SelMemberNews(name).Split('&'); company.UserName = name; //用户名 company.UserPwd = passWord2; //密码 company.TelPhone = txtTelCountry.Value.ToString().Trim() + "-" + txtTelZoneCode.Value.ToString().Trim() + "-" + txtTelNumber.Value.ToString().Trim(); //电话号码 company.Mobile = txtMobile.Value.ToString().Trim(); //手机号码 company.Email = txtEmail.Value.ToString().Trim(); //电子邮箱 company.Audit = 0; //审核状态 company.StartTime = DateTime.Now; //发布时间 company.Valid = 0; //展厅有效期 company.CompanyName = txtCompanyName.Value.ToString().Trim(); //企业名称 company.Typename = num[6].ToString(); //所属类型 company.Countrycode = ZoneSelectControl1.CountryID; company.Provinceid = ZoneSelectControl1.ProvinceID; company.Cityid = ZoneSelectControl1.CityID; company.Countyid = ZoneSelectControl1.CountyID; company.OrderId = 0; //结束处 foreach (Tz888.Model.Common.IndustryModel model in industryModels) { company.Industry += model.IndustryBID + ","; } company.Recomm = "推荐地方"; int add = show.tzAddShow(company); if (add != 1) { Tz888.Common.MessageBox.Show(this.Page, "添加失败"); } else { Tz888.Common.MessageBox.ShowAndHref("添加成功", "tzPost.aspx"); } } else { Tz888.Common.MessageBox.Show(this.Page, "您输入密码不正确,请重新输入!"); } }
//登陆 public void doLogin() { #region //会员登录 //验证用户名与密码是否正确 int ErrorID = 0; string ErrorMsg = ""; Tz888.BLL.Login.LoginInfoBLL loginRule = new Tz888.BLL.Login.LoginInfoBLL(); DataTable dt = new DataTable(); strLoginName = txtLoginName.Value.Trim(); strPassword = txtPassWord.Value.Trim(); dt = loginRule.Authenticate( strLoginName, 0, strPassword, false, ref ErrorID, ref ErrorMsg); if (dt.Rows.Count > 0) { strRoleName = dt.Rows[0]["RoleName"].ToString().Trim(); } if ((dt.Rows.Count > 0) && (strRoleName == "0")) // { InsertLoginLog(strLoginName, strRoleName); //BBS登录 //Tz888DZLogin.BBSLogin(dt.Rows[0]["NickName"].ToString().Trim(), txtPsd.Text.Trim(), dt.Rows[0]["email"].ToString().Trim()); //分配验证票,同时建立角色信息 LoginInfoBLL.SetUserFormsCookie(strLoginName, dt.Rows[0]["MemberGradeID"].ToString().Trim(), dt.Rows[0]["ManageTypeID"].ToString().Trim(), true); if (!(HttpContext.Current.User == null)) { if (HttpContext.Current.User.Identity.AuthenticationType == "Forms") { System.Web.Security.FormsIdentity id; id = (System.Web.Security.FormsIdentity)HttpContext.Current.User.Identity; String[] myRoles = new String[4]; myRoles[0] = "1001"; myRoles[1] = "1002"; myRoles[2] = "1003"; myRoles[3] = "1004"; HttpContext.Current.User = new System.Security.Principal.GenericPrincipal(id, myRoles); } } divLogin.Visible = false; divLoginOk.Visible = true; lblNickName.Text = dt.Rows[0]["NickName"].ToString(); } else { InsertLoginErrorLog(strLoginName); if (dt.Rows.Count == 0) { Tz888.Common.MessageBox.ShowAndHref("您输入的用户名或密码不正确,请重新登录!", this.Request.Url.ToString()); } } #endregion }
protected void btnLogin_Click(object sender, EventArgs e) { int ErrorID = 0; string ErrorMsg = ""; Tz888.BLL.Login.LoginInfoBLL loginRule = new Tz888.BLL.Login.LoginInfoBLL(); DataTable dt = new DataTable(); strLoginName = txtLoginName.Value.Trim(); strPassword = txtPassWord.Value.Trim(); dt = loginRule.Authenticate( strLoginName, 0, strPassword, false, ref ErrorID, ref ErrorMsg); if (dt.Rows.Count > 0) // { strRoleName = dt.Rows[0]["RoleName"].ToString().Trim(); InsertLoginLog(strLoginName, strRoleName); //写登陆cookie开始 HttpCookie loginedUser = new HttpCookie("loginedUser"); loginedUser.Expires = DateTime.Now.AddDays(1); loginedUser.Value = strLoginName; Response.Cookies.Add(loginedUser); ////写登陆cookie结束 //Tz888.BLL.Login.LoginInfoBLL.Logout(); //分配验证票,同时建立角色信息 // LoginInfoBLL.SetUserFormsCookie(strLoginName, dt.Rows[0]["MemberGradeID"].ToString().Trim(), dt.Rows[0]["ManageTypeID"].ToString().Trim(), true); // #region 登录后SESSION记录 用户名,用户角色以及 角色组 // Tz888.BLL.Conn dal = new Tz888.BLL.Conn(); // DataTable dtUser = dal.GetList("VipApplyTab", "BuyTerm", "ApplyID", 1, 1, 0, 1, "LoginName='" + strLoginName + "'"); // string MemberType = ""; // if (dtUser != null && dtUser.Rows.Count > 0) // { // MemberType = dtUser.Rows[0]["BuyTerm"].ToString(); // } // else { MemberType = "1"; } // string[] obj = { strLoginName, dt.Rows[0]["ManageTypeID"].ToString().Trim(), MemberType }; // Session["MemberObj"] = obj; //#endregion //if (!(HttpContext.Current.User == null)) //{ // if (HttpContext.Current.User.Identity.AuthenticationType == "Forms") // { // System.Web.Security.FormsIdentity id; // id = (System.Web.Security.FormsIdentity)HttpContext.Current.User.Identity; // String[] myRoles = new String[6]; // myRoles[0] = "2001"; // myRoles[1] = "2002"; // myRoles[2] = "2003"; // myRoles[3] = "2004"; // myRoles[4] = "2006"; // myRoles[5] = "2007"; // HttpContext.Current.User = new System.Security.Principal.GenericPrincipal(id, myRoles); // } //} // Response.Write("<script>window.close();</script>"); //Response.Write("<script>alert('sssssssss!')</script>"); Response.Write("<script>alert('1');</script>"); } else { InsertLoginErrorLog(strLoginName); if (dt.Rows.Count == 0) { divText.InnerHtml = "您输入的用户名或密码不正确,请重新登录!"; } } }