aboutsummaryrefslogtreecommitdiffhomepage
path: root/site/login.lisp
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2024-06-19 10:49:07 -0700
committercolin <colin@cicadas.surf>2024-06-19 10:49:07 -0700
commit9dbf54efdf2a62565333e58d63bcbfb804ab9442 (patch)
tree502189d0d6f46fae9d980da3e26b6f70954d0b5d /site/login.lisp
parent6e131b7c9c57c8cdf67ed59feafc6c8b56919e8f (diff)
Fix: reorganizing code into modulesHEADmain
Diffstat (limited to 'site/login.lisp')
-rw-r--r--site/login.lisp39
1 files changed, 2 insertions, 37 deletions
diff --git a/site/login.lisp b/site/login.lisp
index 04bf643..3f7e8fa 100644
--- a/site/login.lisp
+++ b/site/login.lisp
@@ -23,38 +23,10 @@
session := (db:with-transaction () (make-instance 'session :user found-user))
(wknd:set-cookie +session-cookie+ :value (key session))))
-(wknd:defendpoint new-account.html
- :get :route "new-account"
- :returns "text/html"
- :handle (new-account-page))
-
-(wknd:defendpoint create-new-account
- :post :to "new-account"
- :parameters
- (username string)
- (password string)
- (password2 string)
- (invite-code string)
- :properties
- (invite invite)
- :authenticate (and
- (equal password password2)
- (setf invite (object-with-key invite-code)))
- :authorize (invite-validp invite)
- :handle (progn
- (db:with-transaction ()
- (when (uses-remaining invite)
- (decf (uses-remaining invite))
- (when (zerop (uses-remaining invite))
- (db:delete-object invite)))
- (let ((user (make-instance 'user :name username)))
- (setf (user-pwhash user) (hash-string password (user-pwsalt user)))))
- (wknd:endpoint-redirect 'login.html)))
-
(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 "/login"
+ (:form :method "POST" :action (wknd:route-to 'login-user)
(:input :placeholder "Name" :name "name")
(:br)
(:input :placeholder "Password" :type "password" :name "password")
@@ -63,13 +35,6 @@
(:a :href (wknd:route-to 'new-account.html)
"Become Undead"))))
-(defun new-account-page ()
- (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"))))
+