diff options
author | Colin Okay <colin@cicadas.surf> | 2022-10-27 07:52:50 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-10-27 07:52:50 -0500 |
commit | 0b21729661ed1905eb886b1eba6f8b062305c9a3 (patch) | |
tree | c3071c5238d1dc174bfaf42ccad59a88d710f043 /model.lisp | |
parent | 52c0408569a0b1de932d52e71fee5fb0163782e2 (diff) |
Modify+Add: Added pw hashing stuff to user. Add login file.
Diffstat (limited to 'model.lisp')
-rw-r--r-- | model.lisp | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -9,9 +9,11 @@ :index-reader object-with-key))) (defclass/bknr user (keyed) - ((name :with :std "") + ((name :with + :index-type string-unique-index + :index-reader user-with-name) (playlists :with :std (list)) - (pw pwhash :with))) + (pwsalt pwhash :with))) (defclass/bknr playlist (keyed) ((title :with :std (default-name "playlist")) @@ -36,6 +38,12 @@ (when (typep obj 'user) obj))) +(defun login-user (username password) + (when-let (user (user-with-name username)) + (with-slots (pwhash pwsalt) user + (when (equalp pwhash (hash-string password pwsalt)) + user)))) + (defun playlist-duration (pl) (reduce #'+ (playlist-tracks pl) |