diff options
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))) |