feat: create Blazor-based login component with EmptyLayout
- Create Login.razor component at /login path with Blazor form - Create EmptyLayout to prevent MainLayout wrapping on login page - Update Program.cs to redirect unauthenticated users to /login (Blazor route) - Integrate with CustomAuthenticationStateProvider for proper auth state management - Handle authentication response and token storage Note: Login flow still has routing issues - investigating dashboard redirect Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -178,13 +178,13 @@ catch (Exception ex)
|
||||
Log.Warning("Hangfire setup failed: {Message}", ex.Message);
|
||||
}
|
||||
|
||||
// Root path - redirect unauthenticated to login.html
|
||||
// Root path - redirect unauthenticated to /login (Blazor component)
|
||||
app.MapGet("/", async (HttpContext ctx) =>
|
||||
{
|
||||
var isAuthenticated = ctx.User?.Identity?.IsAuthenticated ?? false;
|
||||
if (!isAuthenticated)
|
||||
{
|
||||
ctx.Response.Redirect("/login.html");
|
||||
ctx.Response.Redirect("/login");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -194,12 +194,6 @@ app.MapGet("/", async (HttpContext ctx) =>
|
||||
await Task.CompletedTask;
|
||||
});
|
||||
|
||||
// Redirect /login to /login.html (static file)
|
||||
app.MapGet("/login", (HttpContext ctx) =>
|
||||
{
|
||||
ctx.Response.Redirect("/login.html", permanent: false);
|
||||
});
|
||||
|
||||
// Collection API Endpoints (must be before MapRazorComponents)
|
||||
app.MapCollectionEndpoints();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user