summaryrefslogtreecommitdiff
path: root/site/login.lisp
diff options
context:
space:
mode:
authorGrant Shangreaux <grant@unabridgedsoftware.com>2024-06-23 16:42:34 -0500
committerGrant Shangreaux <grant@unabridgedsoftware.com>2024-06-23 16:42:34 -0500
commit68d30b9c81c4e099e0111fe0bbb33715dd572e8c (patch)
treeefb4c43690494fddb47298f253a05092b2564160 /site/login.lisp
parentce470567c4421da7d073685cf845fdc4448aadc0 (diff)
[109] Add: logout action and some session endpoint refactor
Diffstat (limited to 'site/login.lisp')
-rw-r--r--site/login.lisp20
1 files changed, 1 insertions, 19 deletions
diff --git a/site/login.lisp b/site/login.lisp
index d859e0d..7d07bb2 100644
--- a/site/login.lisp
+++ b/site/login.lisp
@@ -5,28 +5,10 @@
:returns "text/html"
:handle (login-page))
-(wknd:defendpoint login.user
- :post :route "login"
- :parameters
- (name string)
- (password string)
- :properties
- (user user)
- :authenticate (authenticate-login-user name password)
- :handle (wknd:endpoint-redirect 'home.html))
-
-(defun authenticate-login-user (name password)
- (do>
- found-user :when= (user-with-name name)
- :when (equal (user-pwhash found-user)
- (hash-string password (user-pwsalt found-user)))
- session := (db:with-transaction () (make-instance 'session :user found-user))
- (wknd:set-cookie +session-cookie+ :value (key session))))
-
(defun login-page ()
(page (:title "V A M P I R E ~ LOGIN")
(:div (:h1 "I vant to suck your blood")
- (:form :method "POST" :action (wknd:route-to 'login.user)
+ (:form :method "POST" :action (wknd:route-to 'session.create)
(:input :placeholder "Name" :name "name")
(:br)
(:input :placeholder "Password" :type "password" :name "password")