diff options
author | Grant Shangreaux <grant@unabridgedsoftware.com> | 2024-06-19 12:01:29 -0500 |
---|---|---|
committer | Grant Shangreaux <grant@unabridgedsoftware.com> | 2024-06-19 12:01:29 -0500 |
commit | 5a586d369c823a040989283a3650444a2b0c0913 (patch) | |
tree | a617035409c3c076c10bcd1449cf5ad70ef8127a /site/login.lisp | |
parent | 132bb57d594894f7c9bdfea23e17971028acaedf (diff) |
[87] Add: invite creation, listing, and deletion when used up
Diffstat (limited to 'site/login.lisp')
-rw-r--r-- | site/login.lisp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/site/login.lisp b/site/login.lisp index 0310fe8..ef4ba26 100644 --- a/site/login.lisp +++ b/site/login.lisp @@ -40,11 +40,13 @@ :authenticate (and (equal password password2) (setf invite (object-with-key invite-code))) - :authorize (or (null (uses-remaining invite)) (plusp (uses-remaining invite))) + :authorize (invite-validp invite) :handle (progn (db:with-transaction () (when (uses-remaining invite) - (decf (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))) |