Example #1
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            //添加SkipCheckLoginAttribute跳过验证
            if (filterContext.ActionDescriptor.IsDefined(typeof(SkipCheckLoginAttribute), false) ||
                filterContext.ActionDescriptor.ControllerDescriptor.IsDefined(typeof(SkipCheckLoginAttribute), false))
            {
                return;
            }

            WebUserModel userMod = BaseController.WebUser;

            if (userMod == null)
            {
                if (filterContext.HttpContext.Request.IsAjaxRequest())
                {
                    ContentResult result = new ContentResult();
                    result.Content       = JsonConvert.SerializeObject(new { rows = new string[0], total = 0, Success = false, Msg = "站点已登出,请重新登录!" });
                    filterContext.Result = result;
                }
                else
                {
                    filterContext.Result = new RedirectResult("/Account/Login");
                }
            }
        }
        public ActionResult EnabledAccount(string keyValue)
        {
            var model = new WebUserModel();

            model.UserID = Convert.ToInt64(keyValue);
            model.Status = 1;
            repCustom.Update(model);
            return(Content(new AjaxResult {
                state = ResultType.success.ToString(), message = "操作成功"
            }.ToJson()));
        }