Writing auth middleware
This commit is contained in:
@ -24,3 +24,7 @@ func ServerError(w http.ResponseWriter, err error) {
|
||||
app.ErrorLog.Println(trace)
|
||||
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
func IsAuthenticated(r *http.Request) bool {
|
||||
return app.Session.Exists(r.Context(), "user_id")
|
||||
}
|
||||
|
Reference in New Issue
Block a user