APCGC_CBS.Admin/Code/CheckLogin.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using APCGC_CBS.Models.Admin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace APCGC_CBS.Admin.Code
{
public class CheckLogin : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (this.CurrentUser == null)
{
filterContext.Result = new RedirectResult("/Home/LoginOut");
return;
}
else
{
string Url = System.Web.HttpContext.Current.Request.Path.ToString();
if (Url.ToLower().IndexOf("/home/login") >= 0)
{
filterContext.Result = new RedirectResult("/Home/Index");
}
if (!this.CurrentUser.IsChangePassword && Url.ToLower().IndexOf("/user/changepwd") < 0)//首次登录强制更改密码
{
filterContext.Result = new RedirectResult("/User/ChangePwd");
}
}
}
/// <summary>
/// 登陆用户信息
/// </summary>
public V_SysUserInfo CurrentUser
{
get
{
try
{
if (System.Web.HttpContext.Current.Session["CacheCurrentUser_Admin"] != null)
return (V_SysUserInfo)System.Web.HttpContext.Current.Session["CacheCurrentUser_Admin"];
else
return null;
}
catch
{
return null;
}
}
set
{
if (value == null)
{
System.Web.HttpContext.Current.Session.Remove("CacheCurrentUser_Admin");
}
else
{
System.Web.HttpContext.Current.Session["CacheCurrentUser_Admin"] = value;
后面还有 5 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。