From 132bb57d594894f7c9bdfea23e17971028acaedf Mon Sep 17 00:00:00 2001 From: colin Date: Sat, 1 Jun 2024 05:59:17 -0700 Subject: Add: page macro, css. Refactor: endpoints for consistent naming --- site/login.lisp | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'site/login.lisp') diff --git a/site/login.lisp b/site/login.lisp index 14852c3..0310fe8 100644 --- a/site/login.lisp +++ b/site/login.lisp @@ -1,6 +1,6 @@ (in-package #:vampire) -(wknd:defendpoint login +(wknd:defendpoint login.html :get :route "login" :returns "text/html" :handle (login-page)) @@ -13,7 +13,7 @@ :properties (user user) :authenticate (authenticate-login-user name password) - :handle (wknd:endpoint-redirect 'home)) + :handle (wknd:endpoint-redirect 'home.html)) (defun authenticate-login-user (name password) (do> @@ -23,7 +23,7 @@ session := (db:with-transaction () (make-instance 'session :user found-user)) (wknd:set-cookie +session-cookie+ :value (key session)))) -(wknd:defendpoint new-account-page +(wknd:defendpoint new-account.html :get :route "new-account" :returns "text/html" :handle (new-account-page)) @@ -47,26 +47,25 @@ (decf (uses-remaining invite))) (let ((user (make-instance 'user :name username))) (setf (user-pwhash user) (hash-string password (user-pwsalt user))))) - (wknd:endpoint-redirect 'login))) + (wknd:endpoint-redirect 'login.html))) (defun login-page () - (with-html-string + (page (:title "V A M P I R E ~ LOGIN") (:div (:h1 "I vant to suck your blood") - (:form :method "POST" :action "/login" - (:input :placeholder "Name" :name "name") - (:br) - (:input :placeholder "Password" :type "password" :name "password") - (:br) - (:button :type "submit" "Click to Login"))) - (:a :href "/new-account" "Come to the Dark Side"))) + (:form :method "POST" :action "/login" + (:input :placeholder "Name" :name "name") + (:br) + (:input :placeholder "Password" :type "password" :name "password") + (:br) + (:button :type "submit" "Click to Login"))))) (defun new-account-page () - (with-html-string + (page (:title "V A M P I R E ~ JOIN") (:form :method "POST" :action "/new-account" - (:input :placeholder "Invite Code" :name "invite-code")(:br) - (:input :placeholder "Username" :name "username")(:br) - (:input :placeholder "Password" :name "password" :type "password")(:br) - (:input :placeholder "Repeat Password" :name "password2" :type "password")(:br) - (:button :type "submit" "Become Undead")))) + (:input :placeholder "Invite Code" :name "invite-code")(:br) + (:input :placeholder "Username" :name "username")(:br) + (:input :placeholder "Password" :name "password" :type "password")(:br) + (:input :placeholder "Repeat Password" :name "password2" :type "password")(:br) + (:button :type "submit" "Become Undead")))) -- cgit v1.2.3