aboutsummaryrefslogtreecommitdiffhomepage
path: root/site
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2024-05-31 10:06:47 -0700
committercolin <colin@cicadas.surf>2024-05-31 10:06:47 -0700
commit2832a7c9e75400e36ca12a028ffcbeece44c8216 (patch)
treec4ad4cc7a63c3c2e54da0ab4bd41bfc6c7edf8ad /site
parente12561b1f2c541b579065c5b40c74957fdab866c (diff)
checkpoint
Diffstat (limited to 'site')
-rw-r--r--site/home.lisp22
-rw-r--r--site/login.lisp10
2 files changed, 32 insertions, 0 deletions
diff --git a/site/home.lisp b/site/home.lisp
new file mode 100644
index 0000000..97c2a87
--- /dev/null
+++ b/site/home.lisp
@@ -0,0 +1,22 @@
+(in-package #:vampire)
+
+(defclass user-known ()
+ ((user :accessor user)))
+
+(defmethod wknd:authenticate ((req user-known))
+ (or
+ (do>
+ key :when= (wknd:get-cookie +session-cookie+)
+ session :when= (object-with-key key)
+ :when (typep session 'session)
+ (setf (user req) (user session)))
+ (weekend:endpoint-redirect 'login)))
+
+(defun home-page (user)
+ (format nil "hey ~a" (user-name user)))
+
+(wknd:defendpoint home
+ :using user-known
+ :get :route ""
+ :returns "text/html"
+ :handle (home-page user))
diff --git a/site/login.lisp b/site/login.lisp
new file mode 100644
index 0000000..afbd80e
--- /dev/null
+++ b/site/login.lisp
@@ -0,0 +1,10 @@
+(in-package #:vampire)
+
+(defun login-page ()
+ "login")
+
+(wknd:defendpoint login
+ :get :route "login"
+ :returns "text/html"
+ :handle (login-page))
+