更新 JWT

This commit is contained in:
chfei committed 2026-08-28 15:31:45 +08:00
1 parent f84c4c1949
commit 8526e5e0d2
10 files changed
+40 -63

No files matched your search

+2 -4
View File
@@ -47,7 +47,6 @@ namespace StoreHub.Controllers
var claims = new List<Claim>
{
new(JwtClaimTypes.UserId, user.Id.ToString()),
new(JwtClaimTypes.UserName, user.UserName),
new(JwtClaimTypes.NickName, user.NickName),
};
@@ -63,9 +62,9 @@ namespace StoreHub.Controllers
[Authorize]
public ApiResult<object?> Logout()
{
if (_currentUser.Id is int userId)
if (_currentUser.UserName is string username)
{
_onlineUserStore.SignOut(userId);
_onlineUserStore.SignOut(username);
}
return ApiResult.Success<object?>(null);
@@ -80,7 +79,6 @@ namespace StoreHub.Controllers
{
return ApiResult.Success<object?>(new
{
UserId = _currentUser.Id,
UserName = _currentUser.UserName,
NickName = _currentUser.NickName,
});