Update formatting for style consistency
This commit is contained in:
@ -44,20 +44,21 @@ userSchema.pre('save', function(next) {
|
|||||||
|
|
||||||
userSchema.methods.comparePassword = function(candidatePassword, cb) {
|
userSchema.methods.comparePassword = function(candidatePassword, cb) {
|
||||||
bcrypt.compare(candidatePassword, this.password, function(err, isMatch) {
|
bcrypt.compare(candidatePassword, this.password, function(err, isMatch) {
|
||||||
if(err) return cb(err);
|
if (err) return cb(err);
|
||||||
cb(null, isMatch);
|
cb(null, isMatch);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a url to a User's Gravatar email
|
* Get a URL to a user's Gravatar email.
|
||||||
*/
|
*/
|
||||||
userSchema.methods.gravatar = function(size,defaults) {
|
|
||||||
|
userSchema.methods.gravatar = function(size, defaults) {
|
||||||
if (!size) size = 200;
|
if (!size) size = 200;
|
||||||
if (!defaults) defaults = 'retro';
|
if (!defaults) defaults = 'retro';
|
||||||
var md5 = crypto.createHash('md5');
|
var md5 = crypto.createHash('md5');
|
||||||
md5.update(this.email);
|
md5.update(this.email);
|
||||||
return 'https://gravatar.com/avatar/' + md5.digest('hex').toString() + '?s='+size+'&d='+defaults;
|
return 'https://gravatar.com/avatar/' + md5.digest('hex').toString() + '?s=' + size + '&d=' + defaults;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = mongoose.model('User', userSchema);
|
module.exports = mongoose.model('User', userSchema);
|
||||||
|
Reference in New Issue
Block a user