Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- name: insert-player @single
- -- Inserts a new player into the database.
- INSERT INTO player (login, email, display_name, pass_hash, pass_salt)
- VALUES(:login, lower(:email), :display_name,
- decode(:hash, 'hex'), decode(:salt, 'hex'))
- RETURNING player_id;
- (defun add-player (login email display-name passphrase &optional activatep)
- "Adds the player with the provided data into the database and optionally
- activates them. Returns the newly created player's database ID."
- (check-type login string)
- (check-type email string)
- (check-type display-name string)
- (check-type passphrase string)
- ;; TODO remove password object from Gateway
- (multiple-value-bind (hash salt) (derive-key passphrase)
- (let ((id (gateway/sql:insert-player :login login :email email
- :display-name display-name
- :hash hash :salt salt)))
- (when activatep (activate-player :id id))))
- t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement