fix: improve login flow with extended wait time
- Update login.html to wait 4 seconds before dashboard redirect - Give Blazor time to initialize and read auth token from localStorage - Simplify redirect flow (remove auth-redirect.html) - Fix token storage in localStorage for auth state Issue: Dashboard access still redirecting to /not-found Root cause: Token from static HTML not being picked up by Blazor auth Next steps: Implement server-side cookie-based auth or refactor to Blazor login 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 (Blazor component)
|
||||
// Root path - redirect unauthenticated to /login.html (static file)
|
||||
app.MapGet("/", async (HttpContext ctx) =>
|
||||
{
|
||||
var isAuthenticated = ctx.User?.Identity?.IsAuthenticated ?? false;
|
||||
if (!isAuthenticated)
|
||||
{
|
||||
ctx.Response.Redirect("/login");
|
||||
ctx.Response.Redirect("/login.html");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -194,6 +194,12 @@ app.MapGet("/", async (HttpContext ctx) =>
|
||||
await Task.CompletedTask;
|
||||
});
|
||||
|
||||
// Map /login to static login.html
|
||||
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