Keep authenticated user entity in sync with persisted login timestamps

ExecuteUpdateAsync bypasses the EF change tracker, so the user entity
returned by AuthenticateUser still carried the old LastLoginDate and
LastActivityDate. SessionManager.LogSessionActivity then saved that
stale entity in full, reverting LastLoginDate (usually to null)
milliseconds after every login. Setting the properties on the entity
keeps the follow-up save consistent and lets the 60-second activity
guard skip the redundant write during login.

Fixes #17301
This commit is contained in:
Elian Van Cutsem
2026-07-11 14:04:07 +02:00
parent 53aafcd38e
commit 47f567b6f1
@@ -616,6 +616,12 @@ namespace Jellyfin.Server.Implementations.Users
.SetProperty(f => f.LastActivityDate, date)
.SetProperty(f => f.LastLoginDate, date))
.ConfigureAwait(false);
// ExecuteUpdateAsync bypasses the change tracker, so keep the
// returned entity in sync. Otherwise SessionManager.LogSessionActivity
// saves this (stale) entity in full and reverts LastLoginDate.
user.LastActivityDate = date;
user.LastLoginDate = date;
}
await dbContext.Users