♻️ Refactored authorize device system (wip) (skip ci)

This commit is contained in:
2025-08-13 02:04:26 +08:00
parent 96cceafe77
commit 76fdf14e79
8 changed files with 52 additions and 27 deletions

View File

@@ -57,6 +57,7 @@ public class AuthController(
.FirstOrDefaultAsync();
if (existingChallenge is not null) return existingChallenge;
var device = await auth.GetOrCreateDeviceAsync(account.Id, request.DeviceId);
var challenge = new AuthChallenge
{
ExpiredAt = Instant.FromDateTimeUtc(DateTime.UtcNow.AddHours(1)),
@@ -67,7 +68,7 @@ public class AuthController(
IpAddress = ipAddress,
UserAgent = userAgent,
Location = geo.GetPointFromIp(ipAddress),
DeviceId = request.DeviceId,
DeviceId = device.Id,
AccountId = account.Id
}.Normalize();