Exemplo n.º 1
0
        //[ValidateAntiForgeryToken]
        public ActionResult Login(LoginInfo li)
        {
            string temp_session="";
            if (Session["Ginfo"] != null)
            {
                temp_session = Session["Ginfo"].ToString();
            }
            var vc = this.HttpContext.Session["vcode"] as 验证码;
            if (null == vc || string.IsNullOrWhiteSpace(li.VerifyCode))
            {
                ViewBag.WrongLoginMessage = "请填写验证码";
                return View();
            }
            if (li.VerifyCode.ToUpper() != vc.Code)
            {
                ViewBag.WrongLoginMessage = "验证码错误";
                return View();
            }
            var u = this.HttpContext.登录(li.LoginName, li.LoginPwd, li.noExpire);
            Session["Ginfo"] = temp_session;
            //记录登录统计
            登录统计 logindate = new 登录统计();
            logindate.登录结果 = 登录结果.用户名或密码错误;
            logindate.用户数据.用户ID = -1;
            logindate.登录IP = FileHelper.StrHelp.GetIPAddress();
            logindate.内网访问 = false;

            if (null != u)
            {
#if INTRANET
                logindate.内网访问 = true;
                if (!(u is 单位用户 || u is 运营团队))
                {
                    HttpContext.登出();
                    return RedirectToAction("CanNotLoginIntranet", "错误页面");
                }
#endif
                logindate.登录结果 = 登录结果.登录成功;
                logindate.用户数据.用户ID = u.Id;
                登录统计管理.添加登录统计(logindate);
                return Jump(u);
            }

            登录统计管理.添加登录统计(logindate);

            ViewBag.WrongLoginMessage = "用户名或密码错误";
            return View();
        }
Exemplo n.º 2
0
 public static bool 更新登录统计(登录统计 content, bool s = true, bool f = true)
 {
     return Mongo.更新(content, f);
 }
Exemplo n.º 3
0
 public static bool 添加登录统计(登录统计 content)
 {
     return Mongo.添加(content);
 }