From 7e84b862912304a36f18dabfa76c85d515efc9dc Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Tue, 13 Sep 2022 18:29:10 +0100 Subject: [PATCH] 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. --- src/web.lisp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/web.lisp b/src/web.lisp index 541f200..ea9d97c 100644 --- a/src/web.lisp +++ b/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"))