feat(web): route unauthenticated root to /welcome, deep links to login
An unauthenticated visit to / now lands on the public /welcome page instead of bouncing straight to Dex. Deeper guarded paths still redirect to /auth/login so the post-login round-trip returns the visitor to the page they asked for. isPublicPath runs first, so no redirect loop. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -248,9 +248,15 @@ func TestMiddlewareRedirectsUnauthenticated(t *testing.T) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}))
|
||||
|
||||
// The bare root sends an unauthenticated visitor to the public landing page.
|
||||
rec := httptest.NewRecorder()
|
||||
guarded.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/", nil))
|
||||
require.Equal(t, http.StatusFound, rec.Code)
|
||||
require.Equal(t, "/welcome", rec.Header().Get("Location"))
|
||||
|
||||
// A deeper guarded path goes to login so the post-login round-trip returns there.
|
||||
rec = httptest.NewRecorder()
|
||||
guarded.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/v/some-id", nil))
|
||||
require.Equal(t, http.StatusFound, rec.Code)
|
||||
require.Equal(t, "/auth/login", rec.Header().Get("Location"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user