Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // CoffeeScript
- auth: (username, password, callback) ->
- hash = @_encodePassword(password)
- @model.find {name: username, encoded_password: hash}, (err, docs) =>
- return callback(false) if docs.length == 0
- user = docs[0]
- @_generateToken user, (token) ->
- callback(user, token)
Add Comment
Please, Sign In to add comment