Refactor name
This commit is contained in:
parent
eb36156c52
commit
606f5df45a
@ -6,8 +6,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CsrfMiddleware validates the CSRF token and returns the handler function if it succeded
|
// Csrf validates the CSRF token and returns the handler function if it succeded
|
||||||
func CsrfMiddleware(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {
|
func Csrf(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
// Verify csrf token
|
// Verify csrf token
|
||||||
_, err := security.VerifyCsrfToken(r)
|
_, err := security.VerifyCsrfToken(r)
|
||||||
|
@ -15,6 +15,6 @@ func PostRoutes(app *app.App) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// User authentication
|
// User authentication
|
||||||
http.HandleFunc("/register-handle", middleware.CsrfMiddleware(postController.Register))
|
http.HandleFunc("/register-handle", middleware.Csrf(postController.Register))
|
||||||
http.HandleFunc("/login-handle", middleware.CsrfMiddleware(postController.Login))
|
http.HandleFunc("/login-handle", middleware.Csrf(postController.Login))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user