add jQuery to check for broken images and replace them with standard image. Remove gravatar logic.

This commit is contained in:
Michael Q Larson
2015-04-02 13:42:15 -07:00
parent 1248cde97f
commit 36c43cc73a
6 changed files with 23 additions and 48 deletions

View File

@@ -346,7 +346,8 @@ var userSchema = new mongoose.Schema({
name: String,
completedWith: String,
solution: String,
githubLink: String
githubLink: String,
verified: Boolean
}
],
currentStreak: {
@@ -390,23 +391,4 @@ userSchema.methods.comparePassword = function(candidatePassword, cb) {
});
};
/**
* Helper method for getting user's gravatar.
*/
userSchema.methods.gravatar = function(size) {
if (!size) { size = 200; }
if (!this.email) {
return 'https://gravatar.com/avatar/?s=' + size + '&d=retro';
}
var md5 = crypto
.createHash('md5')
.update(this.email)
.digest('hex');
return 'https://gravatar.com/avatar/' + md5 + '?s=' + size + '&d=retro';
};
module.exports = mongoose.model('User', userSchema);