refactor: remove unused RequireLogin middleware
This commit is contained in:

committed by
Grail Finder (aider)

parent
10464f402e
commit
3f64e66f87
@ -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) {
|
||||||
|
Reference in New Issue
Block a user