Feature/admin (#831)
* fix redirect to login for admin page fix logout * add admin part url Co-authored-by: cedri <cedri@BAS>
This commit is contained in:
@@ -63,7 +63,7 @@ public class CustomAuthStateProvider : AuthenticationStateProvider
|
||||
|
||||
if (user == null || !user.IsAuthenticated)
|
||||
{
|
||||
return null;
|
||||
return new ClaimsPrincipal(new ClaimsIdentity());
|
||||
}
|
||||
|
||||
var identity = new ClaimsIdentity(
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await HttpClient.PostAsync("Identity/Account/Logout", null);
|
||||
await HttpClient.PostAsync("User/Logout", null);
|
||||
await new Route(JSRuntime).RouteOutside("/Identity/Account/Login");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
@inject NavigationManager Navigation
|
||||
@using System.Web;
|
||||
|
||||
@inject NavigationManager Navigation
|
||||
@inject IJSRuntime JsRuntime
|
||||
|
||||
@code {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Navigation.NavigateTo($"Identity/Account/Login?returnUrl=" +
|
||||
$"/{Uri.EscapeDataString(Navigation.ToBaseRelativePath(Navigation.Uri))}");
|
||||
{
|
||||
var returnUrl = HttpUtility.UrlEncode($"/{Uri.EscapeDataString(Navigation.ToBaseRelativePath(Navigation.Uri))}");
|
||||
JsRuntime.InvokeVoidAsync("location.replace", $"Identity/Account/Login?returnUrl={returnUrl}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user