示例#1
0
 public ActionResult Login()
 {
     if (sysLoginInfo.CurAccount() != null)
     {
         return(RedirectToAction("Index", "WebHome"));
     }
     else
     {
         sysLoginInfo.ClearSession();
         httpContextAccessor.HttpContext.Response.Cookies.Delete(ALLKeys.C_ADMINUSER);
     }
     return(View("~/WebManager/Views/WebEntrance/Login.cshtml"));
 }
示例#2
0
        public ActionResult Logout()
        {
            var user = SysLoginInfo.CurAccount();

            if (user != null)
            {
                accountManager.ClearToken(user.ManagerId);
            }

            SysLoginInfo.ClearSession();
            AuthenticationHelper.SignOut(ALLKeys.C_ADMINUSER);
            return(RedirectToAction("Login"));
        }
示例#3
0
 public ActionResult Login()
 {
     if (SysLoginInfo.CurAccount() != null)
     {
         return(RedirectToAction("Index", "WebHome"));
     }
     else
     {
         SysLoginInfo.ClearSession();
         AuthenticationHelper.SignOut(ALLKeys.C_ADMINUSER);
     }
     return(View("~/WebManager/Views/WebEntrance/Login.cshtml"));
 }
示例#4
0
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            try
            {
                //操作类型(0新增 1修改 2删除 3登录)
                WebSysLog log  = new WebSysLog();
                var       info = SysLoginInfo.CurAccount();
                if (info != null)
                {
                    log.ManagerGuid    = info.ManagerId.ToString();
                    log.ManagerAccount = info.ManagerName;
                }
                log.LogIp   = GetIP();
                log.LogType = _type;
                log.LogTime = DateTime.Now;//操作时间
                log.LogName = _LogTypeName;

                string control = filterContext.Controller.ValueProvider.GetValue("controller").AttemptedValue;
                string action  = filterContext.Controller.ValueProvider.GetValue("action").AttemptedValue;

                //参数说明
                StringBuilder ParamContent = new StringBuilder();
                if (_parameterNameList != "")
                {//根据条件得到参数
                    ParamContent.Append(GetWhereParam(filterContext.Controller.ValueProvider));
                }
                else
                {//获取提交的所有参数
                    ParamContent.Append(GetAllParam(filterContext.Controller.ValueProvider));
                }
                log.MapMethod  = control + "/" + action;  //操作方法
                log.LogContent = ParamContent.ToString(); //参数说明

                //根据数据表设计,进行字符串的裁剪
                log.LogContent = log.LogContent.Length > 4000 ? log.LogContent.Substring(0, 4000) : log.LogContent;
                log.MapMethod  = log.MapMethod.Length > 100 ? log.MapMethod.Substring(0, 100) : log.MapMethod;

                web_managerEntities db = new web_managerEntities(Encrypt.StringDecodeOne(DBConfigure.ConnStr));
                db.WebSysLog.Add(log);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                //LogHelper.WriteLog("写操作日志错误", ex);
            }
        }