mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-25 21:09:05 +01:00
Fix key clash for username
This commit is contained in:
parent
efc3e1735b
commit
178c8ccce6
@ -35,10 +35,10 @@ func setupRoutes(router *mux.Router, routes []Route) {
|
||||
}
|
||||
|
||||
if user := auth.GetUser(r.Context()); user != nil {
|
||||
infos["username"] = user.Username
|
||||
infos["loginId"] = user.Username
|
||||
infos["admin"] = user.HasRole(auth.RoleAdmin)
|
||||
} else {
|
||||
infos["username"] = false
|
||||
infos["loginId"] = false
|
||||
infos["admin"] = false
|
||||
}
|
||||
|
||||
|
@ -133,6 +133,7 @@ func setupJobRoute(i InfoType, r *http.Request) InfoType {
|
||||
|
||||
func setupUserRoute(i InfoType, r *http.Request) InfoType {
|
||||
i["id"] = mux.Vars(r)["id"]
|
||||
i["username"] = mux.Vars(r)["id"]
|
||||
return i
|
||||
}
|
||||
|
||||
@ -359,10 +360,10 @@ func main() {
|
||||
}
|
||||
|
||||
if user := auth.GetUser(r.Context()); user != nil {
|
||||
infos["username"] = user.Username
|
||||
infos["loginId"] = user.Username
|
||||
infos["admin"] = user.HasRole(auth.RoleAdmin)
|
||||
} else {
|
||||
infos["username"] = false
|
||||
infos["loginId"] = false
|
||||
infos["admin"] = false
|
||||
}
|
||||
|
||||
|
@ -69,13 +69,13 @@
|
||||
{{end}}
|
||||
{{end}}
|
||||
</ul>
|
||||
{{if .Infos.username }}
|
||||
{{if .Infos.loginId }}
|
||||
<div class="d-flex align-items-end">
|
||||
<ul class="navbar-nav ml-auto">
|
||||
<li class="nav-item">
|
||||
<form method="post" action="/logout">
|
||||
<button type="submit" class="btn btn-link nav-link fs-5">
|
||||
<span class="cc-nav-text">{{ .Infos.username }} Logout</span>
|
||||
<span class="cc-nav-text">{{ .Infos.loginId }} Logout</span>
|
||||
<i class="bi-box-arrow-right"></i>
|
||||
</button>
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user