summaryrefslogtreecommitdiff
path: root/site/home.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'site/home.lisp')
-rw-r--r--site/home.lisp22
1 files changed, 22 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))