refactor: remove unused RequireLogin middleware

This commit is contained in:
Grail Finder
2025-05-02 10:21:11 +03:00
committed by Grail Finder (aider)
parent 10464f402e
commit 3f64e66f87

View File

@ -16,16 +16,7 @@ var (
memcache cache.Cache memcache cache.Cache
) )
// RequireLogin redirects unauthenticated users to the login page // add middleware to log http requests; ai!
func RequireLogin(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Context().Value("username") == nil {
http.Redirect(w, r, "/login", http.StatusFound)
return
}
next.ServeHTTP(w, r)
})
}
func GetSession(next http.Handler) http.Handler { func GetSession(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {