diff options
| author | haturatu <taro@eyes4you.org> | 2025-10-13 07:01:46 +0900 |
|---|---|---|
| committer | haturatu <taro@eyes4you.org> | 2025-10-13 07:01:46 +0900 |
| commit | af646a893e3b66b2b868d2d0f4216362477a4fba (patch) | |
| tree | 4be49ae0140cb5b9849831333cbdccb0fdd279cc /handlers/auth_login.go | |
| parent | 18991704b375db4e8d22785bb47f3e2e12cd016f (diff) | |
support: xsrf
Diffstat (limited to 'handlers/auth_login.go')
| -rw-r--r-- | handlers/auth_login.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/handlers/auth_login.go b/handlers/auth_login.go index 5621dcb..33a3482 100644 --- a/handlers/auth_login.go +++ b/handlers/auth_login.go @@ -3,14 +3,13 @@ package handlers import ( "auth-proxy/config" "auth-proxy/logging" + "auth-proxy/middleware" "auth-proxy/models" "auth-proxy/types" "errors" "html/template" "net/http" "time" - - "github.com/gorilla/csrf" ) var templates = template.Must(template.ParseGlob("templates/*.html")) @@ -88,7 +87,7 @@ func renderLoginWithError(w http.ResponseWriter, r *http.Request, message string "Paths": config.Paths, "Error": message, "RegisterEnabled": config.Paths.RegisterEnabled, - "CSRFToken": csrf.Token(r), + "XSRFToken": middleware.GetXSRFToken(r), } w.WriteHeader(http.StatusUnauthorized) // Set status to indicate failure if err := templates.ExecuteTemplate(w, "login.html", data); err != nil { @@ -114,7 +113,7 @@ func LoginHandler(w http.ResponseWriter, r *http.Request) { data := map[string]interface{}{ "Paths": config.Paths, "RegisterEnabled": config.Paths.RegisterEnabled, - "CSRFToken": csrf.Token(r), + "XSRFToken": middleware.GetXSRFToken(r), } if err := templates.ExecuteTemplate(w, "login.html", data); err != nil { logging.AppLog.Error("Failed to execute login template", "error", err, "ip", ip) |
