Added login function
This commit is contained in:
parent
a1a928e7cb
commit
9d08b056f3
2 changed files with 70 additions and 5 deletions
18
main.go
18
main.go
|
|
@ -99,6 +99,7 @@ func main() { // {{{
|
|||
}
|
||||
|
||||
http.HandleFunc("/", rootHandler)
|
||||
http.HandleFunc("/login", pageLogin)
|
||||
http.HandleFunc("/authenticate", AuthManager.AuthenticationHandler)
|
||||
http.HandleFunc("/service_worker.js", pageServiceWorker)
|
||||
listen := fmt.Sprintf("%s:%d", config.Network.Address, config.Network.Port)
|
||||
|
|
@ -136,9 +137,8 @@ func pageServiceWorker(w http.ResponseWriter, r *http.Request) { // {{{
|
|||
return
|
||||
}
|
||||
} // }}}
|
||||
|
||||
func pageIndex(w http.ResponseWriter, r *http.Request) { // {{{
|
||||
// Index page is rendered since everything
|
||||
// else are specifically handled.
|
||||
page := HTMLTemplate.SimplePage{
|
||||
Layout: "main",
|
||||
Page: "index",
|
||||
|
|
@ -151,6 +151,20 @@ func pageIndex(w http.ResponseWriter, r *http.Request) { // {{{
|
|||
return
|
||||
}
|
||||
} // }}}
|
||||
func pageLogin(w http.ResponseWriter, r *http.Request) { // {{{
|
||||
page := HTMLTemplate.SimplePage{
|
||||
Layout: "main",
|
||||
Page: "login",
|
||||
Version: VERSION,
|
||||
}
|
||||
|
||||
err := Webengine.Render(page, w, r)
|
||||
if err != nil {
|
||||
w.Write([]byte(err.Error()))
|
||||
return
|
||||
}
|
||||
} // }}}
|
||||
|
||||
func sessionFilter(fn func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request) { // {{{
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Printf("Filtered ")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue