guichet/home.go

36 lines
573 B
Go
Raw Normal View History

2023-07-21 04:37:18 +00:00
/*
home show the home page
*/
package main
import "net/http"
type HomePageData struct {
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) {
login := checkLogin(w, r)
if login == nil {
2023-07-25 12:34:19 +00:00
handleLogin(w, r)
2023-07-21 04:37:18 +00:00
return
}
2023-07-25 12:34:19 +00:00
templateHome := getTemplate("home.html")
data := &HomePageData{
Login: login,
BaseDN: config.BaseDN,
Org: config.Org,
CanAdmin: login.CanAdmin,
LoggedIn: true,
}
templateHome.Execute(w, data)
2023-07-21 04:37:18 +00:00
}