Added resend, fixed CSRF
This commit is contained in:
@@ -14,7 +14,6 @@ import (
|
||||
"fr.latosa-escrima/api"
|
||||
"fr.latosa-escrima/core"
|
||||
"fr.latosa-escrima/utils"
|
||||
"github.com/gorilla/csrf"
|
||||
)
|
||||
|
||||
var CORS_AllowOrigin string
|
||||
@@ -56,12 +55,6 @@ func main() {
|
||||
|
||||
defer core.DB.Close()
|
||||
|
||||
CSRFMiddleware := csrf.Protect(
|
||||
core.CSRF_KEY,
|
||||
csrf.Secure(environ != "DEV"),
|
||||
csrf.HttpOnly(true),
|
||||
)
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
baseRoutes := map[string]core.Handler{
|
||||
@@ -73,11 +66,11 @@ func main() {
|
||||
}},
|
||||
"/contact": {
|
||||
Handler: api.HandleContact,
|
||||
Middlewares: []core.Middleware{api.Methods("POST"), CSRFMiddleware},
|
||||
Middlewares: []core.Middleware{api.Methods("POST"), api.CSRFMiddleware},
|
||||
},
|
||||
"/csrf-token": {
|
||||
Handler: api.HandleCSRF,
|
||||
Middlewares: []core.Middleware{api.Methods("GET"), CSRFMiddleware},
|
||||
Middlewares: []core.Middleware{api.Methods("GET"), api.CSRFMiddleware},
|
||||
},
|
||||
}
|
||||
routes := utils.MergeMaps(
|
||||
|
||||
Reference in New Issue
Block a user