File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 8383
8484; ; Views.
8585(defun loggedin-p ()
86- (hunchentoot :session-value ' user ))
86+ (hunchentoot :session-value ' name ))
8787
88- ; ; GET
89- ( easy-routes :defroute admin-route ( " /admin/ " :method :get ) ( )
88+ ( defun @auth (next)
89+ ( log :info " checking session " )
9090 (if (loggedin-p)
91- (render *template-welcome* )
91+ (funcall next )
9292 (render *template-login* )))
9393
94+ ; ; GET
95+ (easy-routes :defroute admin-route (" /admin/" :method :get :decorators ((@auth))) ()
96+ (render *template-welcome* :name (hunchentoot :session-value ' name)))
97+
98+ ; ; using @auth is equivalent to doing a check in the route body:
99+ #|
100+ (if (loggedin-p)
101+ (render *template-welcome*)
102+ (render *template-login*))
103+ |#
104+
94105; ; POST
95106(easy-routes :defroute admin-route/POST (" /admin/" :method :post ) (name password)
96107 (cond
You can’t perform that action at this time.
0 commit comments