//注册成功页面  验证邮箱页面
 // GET: /RegisterSuccessMail/
 public ActionResult RegisterSuccessPage()
 {
     string successname = RequestBase.GetString("username");
     string successusertype = RequestBase.GetString("usertype");
     if (LoginMember != null)
     {
         ViewData["IsLogin"] = true;
     }
     else
     {
         ViewData["IsLogin"] = false;
     }
     if (successname != null && successname != "" && successusertype == "0")
     {
         BLL.MemberBase mbbll = new BLL.MemberBase();
         DataSet ds = mbbll.GetList(" m_UserName='******' and m_UserType=0");
         string id = ds.Tables[0].Rows[0]["m_ID"].ToString();
         Model.MemberBase mbmodel = new Model.MemberBase();
         mbmodel = mbbll.GetModel(int.Parse(id));
         mbmodel.m_StatusCode = 0;
         mbmodel.m_mailyanzheng = true;
         if (mbbll.Update(mbmodel))
         {
             ViewData["ueername"] = "恭喜您," + successname + ",邮箱验证成功!";
             return View();
         }
         else
         {
             ViewData["ueername"] = successname + ",数据异常,邮箱验证失败,请联系管理员!";
             return View();
         }
     }
     else
     {
         BLL.MemberBase mbbll = new BLL.MemberBase();
         DataSet ds = mbbll.GetList(" m_UserName='******' and m_UserType=2");
         string id = ds.Tables[0].Rows[0]["m_ID"].ToString();
         Model.MemberBase mbmodel = new Model.MemberBase();
         mbmodel = mbbll.GetModel(int.Parse(id));
         mbmodel.m_StatusCode = 0;
         mbmodel.m_ShenPstatus = 1;
         if (mbbll.Update(mbmodel))
         {
             ViewData["ueername"] = "恭喜您," + successname + ",邮箱验证成功!";
             return View();
         }
         else
         {
             ViewData["ueername"] = successname + ",数据异常,邮箱验证失败,请联系管理员!";
             return View();
         }
     }
 }
 /// <summary>
 /// 验证身份方法
 /// </summary>
 /// <returns></returns>
 public ActionResult passwordValid()
 {
     int mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID;
     string password = Request.Form["updatepassword"];
     string md5pass=Utils.MD5(password);
     BLL.MemberBase mbbll = new BLL.MemberBase();
     Model.MemberBase mbmodel = mbbll.GetModel(mid);
     if (md5pass == mbmodel.m_Password)
     {
         return RedirectToAction("vipChangePassword", "VipUpdatePassword");
     }
     else {
         return Content("<script>alert('原始密码错误,请检查!');location.href='vipPasswordValidation'</script>");
     }
 }
Exemplo n.º 3
0
        public void DsnsLogon(HttpContext context)
        {
            string username = context.Request.QueryString["uname"].ToString().Trim();
            string passwd = context.Request.QueryString["passwd"].ToString().Trim();
            passwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(passwd, "MD5");
            string AutoLogon = context.Request.QueryString["AutoLogon"].ToString();
            BLL.MemberBase bll = new BLL.MemberBase();
            DataSet ds = bll.GetList(string.Format(" m_UserName='******' and m_Password='******' and m_UserType=2", username, passwd));
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr = ds.Tables[0].Rows[0];
                if (dr["m_StatusCode"].ToString() == "1")
                {
                    context.Response.Write("账号异常,请联系工作人员");
                }
                else if (dr["m_ShenPstatus"].ToString() == "0")
                {
                    context.Response.Write("账号未审核");
                }
                else
                {
                    DateTime ckExpires = DateTime.Now.AddHours(1);
                    if (AutoLogon == "1")
                    {
                        ckExpires = DateTime.Now.AddDays(7);
                    }
                    Model.MemberBase model = bll.GetModel(int.Parse(dr["m_id"].ToString()));
                    context.Response.Cookies["UserInfo"].Value = CookieEncrypt.SerializeObject(model);
                    context.Response.Cookies["UserInfo"].Expires = ckExpires;

                    string url = context.Request.UrlReferrer.AbsoluteUri;
                    context.Response.Write("1");

                }
            }
            else
            {
                context.Response.Write("账号不存在或用户名密码错误");
            }
        }
 /// <summary>
 /// 输入新密码方法
 /// </summary>
 /// <returns></returns>
 public ActionResult vipChangePasswordValid()
 {
     try
     {
         int mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID;
         string password = Request.Form["password"];
         string md5pass = Utils.MD5(password);
         BLL.MemberBase mbbll = new BLL.MemberBase();
         Model.MemberBase mbmodel = mbbll.GetModel(mid);
         mbmodel.m_ID = mid;
         mbmodel.m_Password = md5pass;
         if (new BLL.MemberBase().Update(mbmodel))
         {
             //重新保存登录缓存
             var model = _memberBase.GetModel(LoginMember.m_ID);
             System.Web.HttpContext.Current.Response.Cookies["UserInfo"].Value = CookieEncrypt.SerializeObject(model);
             System.Web.HttpContext.Current.Response.Cookies["UserInfo"].Expires = DateTime.Now.AddMinutes(180);
             return RedirectToAction("vipSuccessPassword");
         }
         else {
             return Content("<script>alert('修改密码失败,系统异常!');location.href='vipChangePassword'</script>");
         }
     }
     catch (Exception)
     {
       return Content("<script>alert('修改密码失败,系统异常!');location.href='vipChangePassword'</script>");
     }
 }