Files
ProxmoxAAS-Dashboard/app/routes/settings.go
T
alu 98790dbe3b
tronnet/workflows: Static Analysis -- Golang / static-go (push) Failing after 5s
rewrite using net/http
2026-10-22 19:03:37 +00:00

36 lines
722 B
Go

package routes
import (
"bytes"
"net/http"
"proxmoxaas-dashboard/app/common"
)
func HandleGETSettings(w http.ResponseWriter, r *http.Request) {
auth, err := common.GetAuthFromRequest(r)
if err == nil {
_, err := GetUserBasic(auth)
if err != nil {
common.HandleNonFatalError(w, err)
return
}
w.Header().Set("Content-Type", "text/html")
body := bytes.Buffer{}
err = common.TMPL.ExecuteTemplate(&body, "html/settings.html", map[string]any{
"global": common.Global,
"page": "settings",
})
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
} else {
w.Write(body.Bytes())
return
}
} else {
http.Redirect(w, r, "/login", http.StatusFound)
return
}
}