Updated front-end authentication.

This commit is contained in:
2026-02-22 21:47:34 -05:00
parent 8348603b13
commit 80ca1296e5
13 changed files with 184 additions and 56 deletions

View File

@@ -1,4 +1,5 @@
@page "/login"
@layout LoginLayout
@using JSMR.UI.Blazor.Services
@@ -9,29 +10,23 @@
@if (Session.IsAuthenticated)
{
<p>You're already logged in as <b>@Session.Me?.name</b>.</p>
<p>You're already logged in as <b>@Session.Me?.Name</b>.</p>
<button @onclick="Logout">Logout</button>
}
else
{
<div style="max-width: 360px;">
<div>
<label>Username</label><br />
<input @bind="username" />
</div>
<div style="margin-top: 8px;">
<label>Password</label><br />
<input type="password" @bind="password" />
</div>
<div style="margin-top: 12px;">
<button @onclick="LoginAsync" disabled="@busy">Login</button>
</div>
@if (!string.IsNullOrWhiteSpace(error))
{
<p style="color: crimson; margin-top: 8px;">@error</p>
}
<BitCard>
<BitStack>
<BitTextField Label="Username" @bind-Value="username"></BitTextField>
<BitTextField Label="Password" @bind-Value="password" Type="BitInputType.Password"></BitTextField>
<BitButton OnClick="LoginAsync" IsEnabled="@(!busy)">Login</BitButton>
@if (!string.IsNullOrWhiteSpace(error))
{
<p style="color: crimson; margin-top: 8px;">@error</p>
}
</BitStack>
</BitCard>
</div>
}