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