fix(auth): redirect tenant users to /tenant/{slug}/dashboard after login

Admin users continue to redirect to /manage/ as before. Tenant users
now land on their own dashboard at /tenant/{slug}/dashboard instead of
the incorrect /manage/{slug} path. The fix applies to both the
already-logged-in check in HandleLoginUI and the post-login switch in
HandleLoginPost.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Jesko Anschütz 2026-03-23 21:32:12 +01:00
parent dd3ec070f7
commit 1e90bbbbc0

View file

@ -37,7 +37,7 @@ func HandleLoginUI(authStore *store.AuthStore, cfg config.Config) http.HandlerFu
if u.Role == "admin" {
http.Redirect(w, r, "/admin", http.StatusSeeOther)
} else if u.TenantSlug != "" {
http.Redirect(w, r, "/manage/"+u.TenantSlug, http.StatusSeeOther)
http.Redirect(w, r, "/tenant/"+u.TenantSlug+"/dashboard", http.StatusSeeOther)
} else {
http.Redirect(w, r, "/admin", http.StatusSeeOther)
}
@ -122,12 +122,12 @@ func HandleLoginPost(authStore *store.AuthStore, cfg config.Config) http.Handler
}
switch user.Role {
case "admin":
http.Redirect(w, r, "/admin", http.StatusSeeOther)
http.Redirect(w, r, "/manage/", http.StatusSeeOther)
default:
if user.TenantSlug != "" {
http.Redirect(w, r, "/manage/"+user.TenantSlug, http.StatusSeeOther)
http.Redirect(w, r, "/tenant/"+user.TenantSlug+"/dashboard", http.StatusSeeOther)
} else {
http.Redirect(w, r, "/admin", http.StatusSeeOther)
http.Redirect(w, r, "/manage/", http.StatusSeeOther)
}
}
}