diff options
author | Dennis Eriksen <dennis.se@gmail.com> | 2013-05-14 15:11:18 +0200 |
---|---|---|
committer | Dennis Eriksen <dennis.se@gmail.com> | 2013-05-14 15:11:18 +0200 |
commit | c42b1b9be8e57ca186b653b366ddddac6b0bedf2 (patch) | |
tree | edf631170e60d906d526e60f10f79f0114545a15 | |
parent | added local login (diff) | |
download | Divid-c42b1b9be8e57ca186b653b366ddddac6b0bedf2.tar.gz |
added method for retrieving user based on email
-rw-r--r-- | models/User.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/models/User.js b/models/User.js index a40ba34..63f2d4a 100644 --- a/models/User.js +++ b/models/User.js @@ -158,6 +158,23 @@ UserSchema.methods = { } } +UserSchema.statics = { + + /** + * Load user from their email address + * + * @param {String} email + * @param {Function} callback + * @api private + */ + + loadUser: function(email, callback) { + this.findOne({ email: email }) + .exec(callback); + } + +} + mongoose.model('User', UserSchema); |