Add a 404 page
This commit is contained in:
parent
137357cd12
commit
d0f6b83423
6 changed files with 45 additions and 23 deletions
16
admin.go
16
admin.go
|
@ -15,7 +15,7 @@ type settingsData struct {
|
|||
|
||||
func settingsHandler(w http.ResponseWriter, r *http.Request, sess *Session) {
|
||||
if sess.User == "" {
|
||||
http.NotFound(w, r)
|
||||
notFound(w)
|
||||
return
|
||||
}
|
||||
if r.Method == "POST" {
|
||||
|
@ -40,7 +40,7 @@ func settingsHandler(w http.ResponseWriter, r *http.Request, sess *Session) {
|
|||
|
||||
func deleteHandler(w http.ResponseWriter, r *http.Request, sess *Session) {
|
||||
if sess.User == "" {
|
||||
http.NotFound(w, r)
|
||||
notFound(w)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -80,13 +80,13 @@ func deleteHandler(w http.ResponseWriter, r *http.Request, sess *Session) {
|
|||
|
||||
func editHandler(w http.ResponseWriter, r *http.Request, sess *Session) {
|
||||
if sess.User == "" {
|
||||
http.NotFound(w, r)
|
||||
notFound(w)
|
||||
return
|
||||
}
|
||||
id := bson.ObjectIdHex(mux.Vars(r)["id"])
|
||||
books, _, err := db.GetBooks(bson.M{"_id": id})
|
||||
if err != nil {
|
||||
http.NotFound(w, r)
|
||||
notFound(w)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ func cleanEmptyStr(s []string) []string {
|
|||
|
||||
func saveHandler(w http.ResponseWriter, r *http.Request, sess *Session) {
|
||||
if sess.User == "" {
|
||||
http.NotFound(w, r)
|
||||
notFound(w)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ func saveHandler(w http.ResponseWriter, r *http.Request, sess *Session) {
|
|||
book["keywords"] = keywords(book)
|
||||
err := db.UpdateBook(id, book)
|
||||
if err != nil {
|
||||
http.NotFound(w, r)
|
||||
notFound(w)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ type newData struct {
|
|||
|
||||
func newHandler(w http.ResponseWriter, r *http.Request, sess *Session) {
|
||||
if sess.User == "" {
|
||||
http.NotFound(w, r)
|
||||
notFound(w)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ func newHandler(w http.ResponseWriter, r *http.Request, sess *Session) {
|
|||
|
||||
func storeHandler(w http.ResponseWriter, r *http.Request, sess *Session) {
|
||||
if sess.User == "" {
|
||||
http.NotFound(w, r)
|
||||
notFound(w)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue