🐛 Still bug fixes in auth service

This commit is contained in:
2025-08-25 23:01:17 +08:00
parent 0221d7b294
commit c30946daf6
3 changed files with 16 additions and 10 deletions

View File

@@ -24,7 +24,7 @@ public class WebSocketController(WebSocketService ws, ILogger<WebSocketContext>
}
var accountId = currentUser.Id!;
var deviceId = currentSession.Challenge.DeviceId!;
var deviceId = currentSession.Challenge?.DeviceId ?? Guid.NewGuid().ToString();
if (string.IsNullOrEmpty(deviceId))
{
@@ -67,7 +67,11 @@ public class WebSocketController(WebSocketService ws, ILogger<WebSocketContext>
catch (Exception ex)
{
logger.LogError(ex,
"WebSocket disconnected with user @{UserName}#{UserId} and device #{DeviceId} unexpectedly");
"WebSocket disconnected with user @{UserName}#{UserId} and device #{DeviceId} unexpectedly",
currentUser.Name,
currentUser.Id,
deviceId
);
}
finally
{