Exemplo n.º 1
0
        public ActionResult AjaxCheckShowAuthCode(string customerID)
        {
            bool verifycode = false;

            verifycode = LoginFacade.CheckShowAuthCode(customerID);
            return(Json(new { verifycode = verifycode }));
        }
Exemplo n.º 2
0
        public ActionResult AjaxLogin()
        {
            var model = new LoginVM();

            this.TryUpdateModel <LoginVM>(model);
            //判断是否需要输入验证码
            bool showAuthCode = LoginFacade.CheckShowAuthCode(model.CustomerID);

            if (showAuthCode)
            {
                string verifyCode = CookieHelper.GetCookie <String>("VerifyCode");
                if (!String.Equals(verifyCode, model.ValidatedCode, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(Json(new { type = "f", verifycode = "y", message = "验证码不正确" }, JsonRequestBehavior.AllowGet));
                }
            }
            if (UserMgr.Login(model))
            {
                return(Json(new { type = "s" }, JsonRequestBehavior.AllowGet));
            }
            if (showAuthCode)
            {
                return(Json(new { type = "f", verifycode = "y", message = "登录账户名或密码不正确" }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { type = "f", message = "登录账户名或密码不正确" }, JsonRequestBehavior.AllowGet));
        }