mirror of
https://github.com/chylex/Minecraft-Phantom-Panel.git
synced 2024-11-21 23:42:45 +01:00
31 lines
1.1 KiB
Plaintext
31 lines
1.1 KiB
Plaintext
@using Phantom.Server.Web.Identity.Interfaces
|
|
@using Phantom.Server.Web.Identity.Authentication
|
|
@inject INavigation Nav
|
|
@inject NavigationManager NavigationManager
|
|
|
|
<CascadingAuthenticationState>
|
|
<Router AppAssembly="@typeof(App).Assembly">
|
|
<Found Context="routeData">
|
|
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
|
|
<NotAuthorized>
|
|
@if (!PhantomLoginManager.IsAuthenticated(context.User)) {
|
|
var returnUrl = NavigationManager.ToBaseRelativePath(NavigationManager.Uri).TrimEnd('/');
|
|
Nav.NavigateTo("login" + QueryString.Create("return", returnUrl), forceLoad: true);
|
|
}
|
|
else {
|
|
<h1>Forbidden</h1>
|
|
<p role="alert">You do not have permission to visit this page.</p>
|
|
}
|
|
</NotAuthorized>
|
|
</AuthorizeRouteView>
|
|
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
|
</Found>
|
|
<NotFound>
|
|
<LayoutView Layout="@typeof(MainLayout)">
|
|
<h1>Not Found</h1>
|
|
<p role="alert">Sorry, there's nothing at this address.</p>
|
|
</LayoutView>
|
|
</NotFound>
|
|
</Router>
|
|
</CascadingAuthenticationState>
|