2023-07-26 06:31:43 +00:00
|
|
|
/*
|
|
|
|
home show the home page
|
|
|
|
*/
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
|
|
|
func handleHome(w http.ResponseWriter, r *http.Request) {
|
|
|
|
templateHome := getTemplate("home.html")
|
|
|
|
|
|
|
|
login := checkLogin(w, r)
|
|
|
|
if login == nil {
|
|
|
|
status := handleLogin(w, r)
|
|
|
|
if status == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
login = checkLogin(w, r)
|
|
|
|
}
|
|
|
|
|
|
|
|
can_admin := false
|
|
|
|
if login != nil {
|
|
|
|
can_admin = login.Common.CanAdmin
|
|
|
|
}
|
|
|
|
|
|
|
|
data := HomePageData{
|
|
|
|
Login: NestedLoginTplData{
|
|
|
|
Login: login,
|
|
|
|
},
|
|
|
|
BaseDN: config.BaseDN,
|
|
|
|
Org: config.Org,
|
|
|
|
Common: NestedCommonTplData{
|
|
|
|
CanAdmin: can_admin,
|
|
|
|
CanInvite: true,
|
|
|
|
LoggedIn: true,
|
|
|
|
},
|
|
|
|
}
|
2023-07-27 13:46:59 +00:00
|
|
|
execTemplate(w, templateHome, data.Common, data.Login, *config, data)
|
2023-07-27 13:40:37 +00:00
|
|
|
// templateHome.Execute(w, data)
|
2023-07-26 06:31:43 +00:00
|
|
|
|
|
|
|
}
|