From 655637072ce86424de38e2d412ddea12c7ba2b5a Mon Sep 17 00:00:00 2001 From: Christophe Date: Wed, 15 Apr 2026 21:42:40 +0200 Subject: [PATCH] Corrige la deconnexion du compte joueur --- ChessCubing.App/Components/SiteMenu.razor | 27 ++--------------------- ChessCubing.Server/Program.cs | 6 +++++ 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/ChessCubing.App/Components/SiteMenu.razor b/ChessCubing.App/Components/SiteMenu.razor index af58f55..ec02073 100644 --- a/ChessCubing.App/Components/SiteMenu.razor +++ b/ChessCubing.App/Components/SiteMenu.razor @@ -42,7 +42,7 @@ @DisplayName @DisplayMeta - + Se deconnecter } else @@ -89,7 +89,7 @@ @DisplayName @DisplayMeta - + Se deconnecter } else @@ -395,29 +395,6 @@ } } - private async Task LogoutAsync() - { - if (IsSubmitting) - { - return; - } - - IsSubmitting = true; - FormError = null; - CloseMobileMenu(); - - try - { - await Http.PostAsync("api/auth/logout", null); - AuthenticationStateProvider.SetAnonymous(); - await RefreshAuthenticationStateAsync(); - } - finally - { - IsSubmitting = false; - } - } - private void HandleAuthenticationStateChanged(Task authenticationStateTask) => _ = InvokeAsync(RefreshAuthenticationStateAsync); diff --git a/ChessCubing.Server/Program.cs b/ChessCubing.Server/Program.cs index 27ee2eb..aa3a8de 100644 --- a/ChessCubing.Server/Program.cs +++ b/ChessCubing.Server/Program.cs @@ -291,6 +291,12 @@ app.MapPost("/api/auth/logout", async Task (HttpContext httpContext) => return TypedResults.Ok(AuthSessionResponse.FromUser(new ClaimsPrincipal(new ClaimsIdentity()))); }); +app.MapGet("/api/auth/logout/browser", async Task (HttpContext httpContext) => +{ + await httpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); + return TypedResults.Redirect("/index.html"); +}); + app.Run(); static AdminUserSummaryResponse MapAdminSummary(AdminIdentityUser identity, UserProfileResponse? profile)