From 171e7dcaf08dd4c1cea0a3650a93ea467c20f4e5 Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Sat, 27 Jun 2026 18:44:24 -0500 Subject: [PATCH] Invalidate profile cache when logging out Fixes #422 --- LANCommander.SDK/Clients/AuthenticationClient.cs | 7 +++++-- LANCommander.SDK/Clients/ProfileClient.cs | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/LANCommander.SDK/Clients/AuthenticationClient.cs b/LANCommander.SDK/Clients/AuthenticationClient.cs index 20a0115c..26b99e03 100644 --- a/LANCommander.SDK/Clients/AuthenticationClient.cs +++ b/LANCommander.SDK/Clients/AuthenticationClient.cs @@ -21,7 +21,8 @@ public class AuthenticationClient( IServerConfigurationRefresher configRefresher, ISettingsProvider settingsProvider, ApiRequestFactory apiRequestFactory, - IConnectionClient connectionClient) + IConnectionClient connectionClient, + ProfileClient profileClient) { public async Task AuthenticateAsync(string username, string password, Uri serverAddress) { @@ -101,8 +102,10 @@ public class AuthenticationClient( { logger.LogWarning("Could not logout, server inaccessible"); } - + tokenProvider.SetToken(null); + + profileClient.ClearCache(); } public async Task RegisterAsync(string username, string password, string passwordConfirmation) diff --git a/LANCommander.SDK/Clients/ProfileClient.cs b/LANCommander.SDK/Clients/ProfileClient.cs index f0960fde..777f2a5d 100644 --- a/LANCommander.SDK/Clients/ProfileClient.cs +++ b/LANCommander.SDK/Clients/ProfileClient.cs @@ -32,6 +32,11 @@ namespace LANCommander.SDK.Services return _user; } + public void ClearCache() + { + _user = null; + } + public async Task GetAliasAsync() { try