1602/compound-passport — pull request #24 by cholalabs (2014-01-18 22:24:21+00:00)
Title: Passed the whole user object to make use of the instance methods

```javascript
User.setter.password = function (pass) {
this.salt = this.makeSalt();
this._password = this.encryptPassword(pass);
};

User.prototype.authenticate = function(plainText) {
return this.encryptPassword(plainText) === this.password;
}

User.prototype.makeSalt =function(date) {
return Math.round(((date || new Date()).valueOf() * Math.random())) + '';
}

User.prototype.encryptPassword = function(password) {
return crypto.createHmac('sha1', this.salt).update(password).digest('hex');
}
User.beforeUpdate = function(next) {
this.modified_on = new Date();
next();
}

User.verifyPassword = function(userpassword,user) {

return user.authenticate(userpassword);
};

```