Files

53 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

2026-10-28 13:23:35 +02:00
@page
@model StatiKosev.Pages.InboxModel
@inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Antiforgery
@{
ViewData["Title"] = StringValues["Messages"];
}
@section Head {
2026-10-28 14:22:27 +02:00
<link rel="stylesheet" href="~/styles/account.css" asp-append-version="true"/>
2026-10-28 13:23:35 +02:00
<link rel="stylesheet" href="~/styles/inbox.css" asp-append-version="true"/>
}
2026-10-28 14:22:27 +02:00
@if (!Model.IsAdmin)
{
@* no account: the admin password is checked by PrivateMessageController.Login *@
<form method="post" asp-controller="PrivateMessage" asp-action="Login" class="auth-card" data-once>
2026-10-28 13:23:35 +02:00
<h1>@StringValues["Messages"]</h1>
2026-10-28 14:22:27 +02:00
<label>@StringValues["AdminPassword"]
<input type="password" name="password" required autocomplete="current-password" autofocus/>
</label>
<button type="submit">@StringValues["AdminLogin"]</button>
</form>
}
else
{
@* messages are loaded as JSON from PrivateMessageController by inbox.js *@
<section class="inbox"
data-list="/messages/list"
data-base="/messages"
data-token="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken"
data-anonymous="@StringValues["Anonymous"]"
data-mark-read="@StringValues["MarkRead"]"
data-read="@StringValues["Read"]"
data-empty="@StringValues["NoMessages"]"
data-failed="@StringValues["LoadFailed"]">
<header class="inbox-header">
<h1>@StringValues["Messages"]</h1>
<label><input type="checkbox" class="inbox-unread-only"/> @StringValues["UnreadOnly"]</label>
<form method="post" asp-controller="PrivateMessage" asp-action="Logout" class="inbox-logout">
<button type="submit">@StringValues["AdminLogout"]</button>
</form>
</header>
<p class="inbox-status" role="status" aria-live="polite">@StringValues["Loading"]</p>
<ol class="inbox-list"></ol>
</section>
}
2026-10-28 13:23:35 +02:00
@section Scripts {
2026-10-28 14:22:27 +02:00
@if (Model.IsAdmin)
{
<script src="~/scripts/inbox.js" asp-append-version="true"></script>
}
2026-10-28 13:23:35 +02:00
}