fix(#I123MH): 客户端自动纠正已经删除的客户端登录信息

#Comment
comment #I123MH

#Issue
link https://gitee.com/LongbowEnterprise/BootstrapAdmin/issues/I123MH
This commit is contained in:
Argo Zhang 2019-09-13 10:42:25 +08:00
parent 789685a2ba
commit 55900cc954
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
1 changed files with 6 additions and 1 deletions

View File

@ -9,7 +9,7 @@ using System.Linq;
namespace Bootstrap.DataAccess
{
/// <summary>
///
/// 用户跟踪操作类
/// </summary>
public static class TraceHelper
{
@ -23,6 +23,11 @@ namespace Bootstrap.DataAccess
if (context.User.Identity.IsAuthenticated)
{
var user = UserHelper.RetrieveUserByUserName(context.User.Identity.Name);
// user == null 以前登录过客户端保留了 Cookie 但是用户名可能被系统删除
// link bug: https://gitee.com/LongbowEnterprise/BootstrapAdmin/issues/I123MH
if (user == null) return;
v.UserName = user.UserName;
v.DisplayName = user.DisplayName;
DbContextManager.Create<Trace>().Save(new Trace