From 606f5df45a550e0a424294d500b538daf7cb294f Mon Sep 17 00:00:00 2001 From: Maximilian Date: Sat, 22 Jul 2023 23:37:38 -0500 Subject: [PATCH] Refactor name --- middleware/csrf.go | 4 ++-- routes/postRoutes.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/middleware/csrf.go b/middleware/csrf.go index 544c0c3..de3c04c 100644 --- a/middleware/csrf.go +++ b/middleware/csrf.go @@ -6,8 +6,8 @@ import ( "net/http" ) -// CsrfMiddleware 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) { +// Csrf validates the CSRF token and returns the handler function if it succeded +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) { // Verify csrf token _, err := security.VerifyCsrfToken(r) diff --git a/routes/postRoutes.go b/routes/postRoutes.go index d076cf7..a0d93b1 100644 --- a/routes/postRoutes.go +++ b/routes/postRoutes.go @@ -15,6 +15,6 @@ func PostRoutes(app *app.App) { } // User authentication - http.HandleFunc("/register-handle", middleware.CsrfMiddleware(postController.Register)) - http.HandleFunc("/login-handle", middleware.CsrfMiddleware(postController.Login)) + http.HandleFunc("/register-handle", middleware.Csrf(postController.Register)) + http.HandleFunc("/login-handle", middleware.Csrf(postController.Login)) }