Browse Source

implement the /edit/archive defroute -- updates the entries text.

stable
Craig Oates 2 years ago
parent
commit
44bdec6570
  1. 20
      src/web.lisp

20
src/web.lisp

@ -1167,8 +1167,24 @@
(redirect "/login")))))))
(defroute ("/edit/archive" :method :POST) ()
(utils:set-alert "ROUTE NOT IMPLEMENTED")
(redirect "/user/archive"))
(destructuring-bind
(&key slug page-content authenticity-token &allow-other-keys)
(utils:request-params (lack.request:request-body-parameters ningle:*request*))
(cond ((not (string= authenticity-token (auth:csrf-token)))
`(,+forbidden+ (:content-type "text/plain") ("Denied")))
(t (hermetic:auth
(:logged-in)
;; Authorised
(cond ((utils:string-is-nil-or-empty? slug)
(utils:set-alert "Archive entry cannot be found.")
(redirect "/user/archive"))
(t (storage:store-text "" "archive" slug page-content)
(utils:set-alert "Archive entry updated.")
(redirect (format nil "/edit/archive/~a" slug))))
;; Not Authorised
(progn (utils:set-alert "You are not logged in.")
(redirect "/login")))))))
(defroute ("/archive/delete/entry" :method :POST) ()
(destructuring-bind

Loading…
Cancel
Save