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