Merge branch 'pr/25'

This commit is contained in:
Amos Haviv
2014-04-16 12:51:23 +03:00

View File

@@ -104,6 +104,9 @@ UserSchema.methods.hashPassword = function(password) {
* Create instance method for authenticating user
*/
UserSchema.methods.authenticate = function(password) {
if (!this.password || !this.salt) {
return false;
}
return this.password === this.hashPassword(password);
};