bulletboards/ImageBoardServerApp/Pages/Moderation/ModMenu.razor

32 lines
No EOL
956 B
Text

@page "/sys/modmenu"
@using ImageBoardServerApp.Auth
@inject AuthenticationStateProvider authStateProvider
@inject NavigationManager navManager
<AuthorizeView Roles="Admin,Mod">
<Authorized>
<h3>ModMenu</h3>
<span>Welcome @mail to the mod menu</span>
<div>
<a href="/sys/modmenu/reports">[Reports]</a>
<a href="/sys/modmenu/users">[Users]</a>
<a href="/sys/modmenu/boards">[Boards]</a>
</div>
</Authorized>
<NotAuthorized>
<DeadLink/>
</NotAuthorized>
</AuthorizeView>
@code {
private string mail { get; set; } = "";
protected override async Task OnInitializedAsync()
{
var cauthStateProvder = (CustomAuthenticationStateProvider)authStateProvider;
var user = await cauthStateProvder.GetAuthenticationStateAsync();
if (user.User.Identity.IsAuthenticated)
{
mail = user.User.Identity.Name;
}
}
}