1
This commit is contained in:
@@ -111,7 +111,38 @@ namespace FineUIPro.Web
|
||||
pm.CustomLanguage = langValue;
|
||||
}
|
||||
}
|
||||
// 检查auth_token参数实现iframe自动登录
|
||||
string authToken = Request.QueryString["auth_token"];
|
||||
if (!string.IsNullOrEmpty(authToken) && this.CurrUser == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 解密并验证token
|
||||
string decryptedToken = BLL.TokenHelper.DecryptToken(authToken);
|
||||
var tokenData = JsonConvert.DeserializeObject<dynamic>(decryptedToken);
|
||||
|
||||
// 验证时间戳(2小时有效期)
|
||||
long timestamp = tokenData.timestamp;
|
||||
if (DateTimeOffset.Now.ToUnixTimeSeconds() - timestamp <= 7200) // 2小时 = 7200秒
|
||||
{
|
||||
// 验证用户ID
|
||||
string userId = tokenData.user_id;
|
||||
if (userId == Const.sysglyId)
|
||||
{
|
||||
var user = Person_PersonsService.GetPerson_PersonsById(Const.sysglyId);
|
||||
if (user != null)
|
||||
{
|
||||
this.Session["CurrUser"] = user;
|
||||
BLL.LogService.AddLog(Const.sysglyId, "iframe Token自动登录成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BLL.LogService.AddLog("", $"iframe Token自动登录失败:{ex.Message}");
|
||||
}
|
||||
}
|
||||
// 1. 仅显示基础版示例, 2. 基础版
|
||||
// 上述两种情况都要禁用EnableAnimation、DisplayMode、MobileAdaption
|
||||
bool showOnlyBase = false;
|
||||
|
||||
Reference in New Issue
Block a user