Ejemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            if (context.Request["user_name"] != null)
            {
                string strUserName = StringPlus.Filter(context.Request["user_name"]);
                string strUserPwd  = StringPlus.Filter(context.Request["user_pwd"]);
                int    remember    = Convert.ToInt32(context.Request["check"]);
                TravelAgent.Model.AdminList Account = adminbll.GetAccountByUser(strUserName, strUserPwd);
                if (Account != null)
                {
                    if (Account.IsLock == 0)
                    {
                        string strUrl = "Admin_Default.aspx";

                        context.Response.Write("{\"msg\":\"true\",\"location\":\"" + strUrl + "\"}");
                        context.Session["LoginUser"] = Account;
                        TravelAgent.Tool.CookieHelper.ClearCookie("login_num");
                        //记住用户名和密码并自动登录
                        if (remember == 1)
                        {
                            TravelAgent.Tool.CookieHelper.SetCookie("loginname", strUserName);
                            TravelAgent.Tool.CookieHelper.SetCookie("loginpwd", strUserPwd);
                            TravelAgent.Tool.CookieHelper.SetCookie("isremember", remember.ToString());
                        }
                        else
                        {
                            TravelAgent.Tool.CookieHelper.ClearCookie("loginname");
                            TravelAgent.Tool.CookieHelper.ClearCookie("loginpwd");
                            TravelAgent.Tool.CookieHelper.ClearCookie("isremember");
                        }
                    }
                    else
                    {
                        context.Response.Write("{\"msg\":\"islock\",\"location\":\"\"}");
                    }
                }
                else
                {
                    context.Response.Write("{\"msg\":\"false\",\"location\":\"\"}");
                    login_error_num = string.IsNullOrEmpty(TravelAgent.Tool.CookieHelper.GetCookieValue("login_num"))? 0 : Convert.ToInt32(TravelAgent.Tool.CookieHelper.GetCookieValue("login_num"));
                    TravelAgent.Tool.CookieHelper.ClearCookie("login_num");
                    TravelAgent.Tool.CookieHelper.SetCookie("login_num", (login_error_num + 1).ToString());
                }
            }
        }
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     if (context.Request["pwd"] != null)
     {
         TravelAgent.Model.AdminList curAcc = (TravelAgent.Model.AdminList)context.Session["LoginUser"];
         curAcc.UserPwd = context.Request["pwd"];
         if (AdminBll.Update(curAcc) > 0)
         {
             context.Session["LoginUser"] = curAcc;
             context.Response.Write("true");
         }
         else
         {
             context.Response.Write("false");
         }
     }
 }