AuThEnTiCaTiOn and clean up....
This commit is contained in:
14
main.go
14
main.go
@@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
"synlotto-website/handlers"
|
||||
"synlotto-website/helpers"
|
||||
"synlotto-website/middleware"
|
||||
"synlotto-website/models"
|
||||
"synlotto-website/storage"
|
||||
|
||||
@@ -17,20 +18,21 @@ func main() {
|
||||
|
||||
csrfMiddleware := csrf.Protect(
|
||||
[]byte("32-byte-long-auth-key-here"), // TodO: Make Global
|
||||
csrf.Secure(false),
|
||||
csrf.Secure(true),
|
||||
csrf.Path("/"),
|
||||
)
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.HandleFunc("/", handlers.Home(db))
|
||||
mux.HandleFunc("/new", handlers.NewDraw)
|
||||
mux.HandleFunc("/new", handlers.NewDraw) // ToDo: needs to be wrapped in admin auth
|
||||
mux.HandleFunc("/submit", handlers.Submit)
|
||||
mux.HandleFunc("/ticket", handlers.NewTicket(db))
|
||||
mux.HandleFunc("/tickets", handlers.ListTickets(db))
|
||||
mux.HandleFunc("/submit-ticket", handlers.RequireAuth(handlers.SubmitTicket(db)))
|
||||
mux.HandleFunc("/login", handlers.Login)
|
||||
mux.HandleFunc("/tickets", middleware.Auth(true)(handlers.ListTickets(db)))
|
||||
mux.HandleFunc("/submit-ticket", helpers.AuthMiddleware(handlers.SubmitTicket(db)))
|
||||
mux.HandleFunc("/login", middleware.Auth(false)(handlers.Login))
|
||||
mux.HandleFunc("/logout", handlers.Logout)
|
||||
mux.HandleFunc("/signup", handlers.Signup)
|
||||
mux.HandleFunc("/signup", middleware.Auth(false)(handlers.Signup))
|
||||
|
||||
// Result pages
|
||||
mux.HandleFunc("/results/thunderball", handlers.ResultsThunderball(db))
|
||||
|
||||
Reference in New Issue
Block a user