Guest User

Untitled

a guest
Sep 24th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. // CoffeeScript
  2.  
  3. auth: (username, password, callback) ->
  4. hash = @_encodePassword(password)
  5. @model.find {name: username, encoded_password: hash}, (err, docs) =>
  6. return callback(false) if docs.length == 0
  7. user = docs[0]
  8. @_generateToken user, (token) ->
  9. callback(user, token)
Add Comment
Please, Sign In to add comment