summaryrefslogtreecommitdiff
path: root/site/home.lisp
blob: 97c2a8749edbbe99f412c002123c672207603deb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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))