🍒 fix(auth): 调整token版本更新时机
This commit is contained in:
parent
1a05dbe0fa
commit
a6fd3a1408
@ -229,6 +229,7 @@ public class SysAuthService : IDynamicApiController, ITransient
|
|||||||
await App.GetRequiredService<SysOnlineUserService>().SingleLogin(user.Id, loginMode);
|
await App.GetRequiredService<SysOnlineUserService>().SingleLogin(user.Id, loginMode);
|
||||||
|
|
||||||
// 生成Token令牌
|
// 生成Token令牌
|
||||||
|
user.TokenVersion += 1;
|
||||||
var tokenExpire = await _sysConfigService.GetTokenExpire();
|
var tokenExpire = await _sysConfigService.GetTokenExpire();
|
||||||
var accessToken = JWTEncryption.Encrypt(new Dictionary<string, object>
|
var accessToken = JWTEncryption.Encrypt(new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
@ -263,7 +264,6 @@ public class SysAuthService : IDynamicApiController, ITransient
|
|||||||
// ke.global.setAllHeader('Authorization', 'Bearer ' + ke.response.headers['access-token']);
|
// ke.global.setAllHeader('Authorization', 'Bearer ' + ke.response.headers['access-token']);
|
||||||
|
|
||||||
// 更新用户登录信息
|
// 更新用户登录信息
|
||||||
user.TokenVersion += 1;
|
|
||||||
user.LastLoginIp = _httpContextAccessor.HttpContext.GetRemoteIpAddressToIPv4(true);
|
user.LastLoginIp = _httpContextAccessor.HttpContext.GetRemoteIpAddressToIPv4(true);
|
||||||
(user.LastLoginAddress, double? longitude, double? latitude) = CommonHelper.GetIpAddress(user.LastLoginIp);
|
(user.LastLoginAddress, double? longitude, double? latitude) = CommonHelper.GetIpAddress(user.LastLoginIp);
|
||||||
user.LastLoginTime = DateTime.Now;
|
user.LastLoginTime = DateTime.Now;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user