Corrige la deconnexion du compte joueur
This commit is contained in:
@@ -42,7 +42,7 @@
|
|||||||
<strong>@DisplayName</strong>
|
<strong>@DisplayName</strong>
|
||||||
<span>@DisplayMeta</span>
|
<span>@DisplayMeta</span>
|
||||||
</div>
|
</div>
|
||||||
<button class="button ghost small" type="button" @onclick="LogoutAsync" disabled="@IsSubmitting">Se deconnecter</button>
|
<a class="button ghost small" href="api/auth/logout/browser">Se deconnecter</a>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
<strong>@DisplayName</strong>
|
<strong>@DisplayName</strong>
|
||||||
<span>@DisplayMeta</span>
|
<span>@DisplayMeta</span>
|
||||||
</div>
|
</div>
|
||||||
<button class="button ghost small" type="button" @onclick="LogoutAsync" disabled="@IsSubmitting">Se deconnecter</button>
|
<a class="button ghost small" href="api/auth/logout/browser">Se deconnecter</a>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
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<AuthenticationState> authenticationStateTask)
|
private void HandleAuthenticationStateChanged(Task<AuthenticationState> authenticationStateTask)
|
||||||
=> _ = InvokeAsync(RefreshAuthenticationStateAsync);
|
=> _ = InvokeAsync(RefreshAuthenticationStateAsync);
|
||||||
|
|
||||||
|
|||||||
@@ -291,6 +291,12 @@ app.MapPost("/api/auth/logout", async Task<IResult> (HttpContext httpContext) =>
|
|||||||
return TypedResults.Ok(AuthSessionResponse.FromUser(new ClaimsPrincipal(new ClaimsIdentity())));
|
return TypedResults.Ok(AuthSessionResponse.FromUser(new ClaimsPrincipal(new ClaimsIdentity())));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.MapGet("/api/auth/logout/browser", async Task<IResult> (HttpContext httpContext) =>
|
||||||
|
{
|
||||||
|
await httpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
|
return TypedResults.Redirect("/index.html");
|
||||||
|
});
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|
||||||
static AdminUserSummaryResponse MapAdminSummary(AdminIdentityUser identity, UserProfileResponse? profile)
|
static AdminUserSummaryResponse MapAdminSummary(AdminIdentityUser identity, UserProfileResponse? profile)
|
||||||
|
|||||||
Reference in New Issue
Block a user