guichet/home.go

41 lines
685 B
Go
Raw Normal View History

2023-07-21 04:37:18 +00:00
/*
home show the home page
*/
package main
import "net/http"
func handleHome(w http.ResponseWriter, r *http.Request) {
2023-07-25 12:53:14 +00:00
templateHome := getTemplate("home.html")
2023-07-21 04:37:18 +00:00
login := checkLogin(w, r)
if login == nil {
2023-07-25 13:14:12 +00:00
status := handleLogin(w, r)
if status == nil {
return
}
login = checkLogin(w, r)
2023-07-21 04:37:18 +00:00
}
2023-07-25 12:34:19 +00:00
2023-07-25 13:18:20 +00:00
can_admin := false
if login != nil {
2023-07-25 19:35:22 +00:00
can_admin = login.Common.CanAdmin
2023-07-25 13:18:20 +00:00
}
2023-07-25 12:53:14 +00:00
data := HomePageData{
2023-07-25 19:35:22 +00:00
Login: NestedLoginTplData{
2023-07-25 19:47:10 +00:00
Login: login,
},
2023-07-25 19:35:22 +00:00
BaseDN: config.BaseDN,
Org: config.Org,
Common: NestedCommonTplData{
2023-07-25 19:45:01 +00:00
CanAdmin: can_admin,
CanInvite: true,
2023-07-25 19:47:10 +00:00
LoggedIn: true,
},
2023-07-25 12:34:19 +00:00
}
templateHome.Execute(w, data)
2023-07-21 04:37:18 +00:00
}