2023-07-21 04:37:18 +00:00
|
|
|
/*
|
|
|
|
home show the home page
|
|
|
|
*/
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
|
|
|
type HomePageData struct {
|
2023-07-24 09:05:05 +00:00
|
|
|
Login *LoginStatus
|
|
|
|
BaseDN string
|
|
|
|
Org string
|
|
|
|
CanAdmin bool
|
2023-07-24 14:28:22 +00:00
|
|
|
LoggedIn bool
|
2023-07-21 04:37:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func handleHome(w http.ResponseWriter, r *http.Request) {
|
|
|
|
templateHome := getTemplate("home.html")
|
|
|
|
|
|
|
|
login := checkLogin(w, r)
|
|
|
|
if login == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
data := &HomePageData{
|
2023-07-24 09:12:46 +00:00
|
|
|
Login: login,
|
|
|
|
BaseDN: config.BaseDN,
|
|
|
|
Org: config.Org,
|
|
|
|
CanAdmin: login.CanAdmin,
|
2023-07-24 14:28:22 +00:00
|
|
|
LoggedIn: true,
|
2023-07-21 04:37:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
templateHome.Execute(w, data)
|
|
|
|
}
|