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:
parent
dd3ec070f7
commit
1e90bbbbc0
1 changed files with 4 additions and 4 deletions
|
|
@ -37,7 +37,7 @@ func HandleLoginUI(authStore *store.AuthStore, cfg config.Config) http.HandlerFu
|
||||||
if u.Role == "admin" {
|
if u.Role == "admin" {
|
||||||
http.Redirect(w, r, "/admin", http.StatusSeeOther)
|
http.Redirect(w, r, "/admin", http.StatusSeeOther)
|
||||||
} else if u.TenantSlug != "" {
|
} else if u.TenantSlug != "" {
|
||||||
http.Redirect(w, r, "/manage/"+u.TenantSlug, http.StatusSeeOther)
|
http.Redirect(w, r, "/tenant/"+u.TenantSlug+"/dashboard", http.StatusSeeOther)
|
||||||
} else {
|
} else {
|
||||||
http.Redirect(w, r, "/admin", http.StatusSeeOther)
|
http.Redirect(w, r, "/admin", http.StatusSeeOther)
|
||||||
}
|
}
|
||||||
|
|
@ -122,12 +122,12 @@ func HandleLoginPost(authStore *store.AuthStore, cfg config.Config) http.Handler
|
||||||
}
|
}
|
||||||
switch user.Role {
|
switch user.Role {
|
||||||
case "admin":
|
case "admin":
|
||||||
http.Redirect(w, r, "/admin", http.StatusSeeOther)
|
http.Redirect(w, r, "/manage/", http.StatusSeeOther)
|
||||||
default:
|
default:
|
||||||
if user.TenantSlug != "" {
|
if user.TenantSlug != "" {
|
||||||
http.Redirect(w, r, "/manage/"+user.TenantSlug, http.StatusSeeOther)
|
http.Redirect(w, r, "/tenant/"+user.TenantSlug+"/dashboard", http.StatusSeeOther)
|
||||||
} else {
|
} else {
|
||||||
http.Redirect(w, r, "/admin", http.StatusSeeOther)
|
http.Redirect(w, r, "/manage/", http.StatusSeeOther)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue