Browse Source

refactor functions moved from auth to nera and update init-db setup.

The update part refers to the redirect when a database is found whilst
making a HTTP POST request, as part of the init-db
process (A.K.A. website's first run procedure).

The auth to nera change is because I didn't catch all of the moves in
a previous commit. The image I was running at the time still had the
auth version so it wasn't showing any errors. I spotted this one when
trying to run a new image.
stable
Craig Oates 2 years ago
parent
commit
7e84b86291
  1. 7
      src/web.lisp

7
src/web.lisp

@ -49,10 +49,11 @@
(cond ((not (string= authenticity-token (auth:csrf-token)))
`(,+forbidden+ (:content-type "text/plain") ("Denied")))
((uiop:file-exists-p (ritherdon-archive.config:database-name))
(render #P"initial-setup.html" `(:token ,(auth:csrf-token))))
`(,+service-unavailable+ (:location "/")))
;; (render #P"initial-setup.html" `(:token ,(auth:csrf-token))))
(t (nera-db:init-db
(lack.request:request-body-parameters ningle:*request*))
(redirect "/dashboard")))))
(redirect "/dashboard"))))) ; Redirect to /setup-complete?
(defroute ("/login" :method :GET) ()
(hermetic:auth (:logged-in)
@ -78,7 +79,7 @@
(progn
(setf
;; Set session Id. to the logged in user.
(gethash :id ningle:*session*) (auth:get-user-id username)
(gethash :id ningle:*session*) (nera:get-user-id username)
;; Set the users password (for session)
(gethash :password ningle:*session*) password)
(redirect "/dashboard"))

Loading…
Cancel
Save