From 1ed4de177ff89ac299d5b3017091f973ae38aded Mon Sep 17 00:00:00 2001 From: Las Zenow Date: Tue, 21 Aug 2012 21:27:19 +0200 Subject: [PATCH] Check valid user on /readnew/ --- reader.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/reader.go b/reader.go index 6e3bb54..9866aea 100644 --- a/reader.go +++ b/reader.go @@ -78,6 +78,13 @@ func nextPrev(e *epub.Epub, file string, id string, base string) (string, string func readHandler(coll *mgo.Collection) func(http.ResponseWriter, *http.Request) { return func(w http.ResponseWriter, r *http.Request) { base, id, file, ext := parseUrl(r.URL.Path) + if base == "/readnew/" { + sess := GetSession(r) + if sess.User == "" { + http.NotFound(w, r) + return + } + } books, _, err := GetBook(coll, bson.M{"_id": bson.ObjectIdHex(id)}) if err != nil || len(books) == 0 { http.NotFound(w, r)