2023-01-18 12:56:24 +00:00
|
|
|
@inherits LayoutComponentBase
|
2023-02-01 20:49:02 +00:00
|
|
|
@using ImageBoardServerApp.Auth
|
2023-02-02 17:50:50 +00:00
|
|
|
@inject AuthenticationStateProvider authStateProvider
|
2023-02-01 20:49:02 +00:00
|
|
|
@inject NavigationManager navManager
|
2023-01-18 12:56:24 +00:00
|
|
|
|
|
|
|
<PageTitle>BulletBoard</PageTitle>
|
|
|
|
|
|
|
|
<div class="page">
|
|
|
|
<div class="sidebar">
|
|
|
|
<NavMenu/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<main>
|
2023-02-02 07:15:43 +00:00
|
|
|
|
2023-01-18 12:56:24 +00:00
|
|
|
<div class="top-row px-4">
|
|
|
|
<a href="/faq">[FAQ]</a>
|
|
|
|
<a href="/rules">[Rules]</a>
|
2023-02-01 20:49:02 +00:00
|
|
|
<AuthorizeView>
|
|
|
|
<Authorized>
|
2023-02-02 17:50:50 +00:00
|
|
|
<a @onclick="logout" href="javascript:void(0)">[Logout @mail]</a>
|
2023-02-01 20:49:02 +00:00
|
|
|
</Authorized>
|
|
|
|
<NotAuthorized>
|
2023-02-07 20:21:38 +00:00
|
|
|
<a href="/register">[Register]</a>
|
2023-02-02 07:15:43 +00:00
|
|
|
<a href="/login">[Login]</a>
|
2023-02-01 20:49:02 +00:00
|
|
|
</NotAuthorized>
|
|
|
|
</AuthorizeView>
|
2023-01-18 12:56:24 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<article class="content px-4">
|
|
|
|
@Body
|
|
|
|
</article>
|
|
|
|
</main>
|
2023-02-01 20:49:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
@code
|
|
|
|
{
|
2023-02-02 17:50:50 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-01 20:49:02 +00:00
|
|
|
private async Task logout()
|
|
|
|
{
|
2023-02-02 17:50:50 +00:00
|
|
|
var customAuthStateProvider = (CustomAuthenticationStateProvider) authStateProvider;
|
2023-02-01 20:49:02 +00:00
|
|
|
await customAuthStateProvider.UpdateAuthenticationStateAsync(null);
|
|
|
|
navManager.NavigateTo("/", true);
|
|
|
|
}
|
|
|
|
}
|