|
|
@ -1167,9 +1167,25 @@ |
|
|
|
(redirect "/login"))))))) |
|
|
|
(redirect "/login"))))))) |
|
|
|
|
|
|
|
|
|
|
|
(defroute ("/edit/archive" :method :POST) () |
|
|
|
(defroute ("/edit/archive" :method :POST) () |
|
|
|
(utils:set-alert "ROUTE NOT IMPLEMENTED") |
|
|
|
(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")) |
|
|
|
(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) () |
|
|
|
(defroute ("/archive/delete/entry" :method :POST) () |
|
|
|
(destructuring-bind |
|
|
|
(destructuring-bind |
|
|
|
(&key slug authenticity-token &allow-other-keys) |
|
|
|
(&key slug authenticity-token &allow-other-keys) |
|
|
|