Force a default gravatar if no email provided

Gravatar provides the forceDefault option, let's use it.
v1.18.x
Damian Bushong 12 years ago
parent 78ef54baf2
commit 7a5013325c

@ -224,13 +224,14 @@ var utils = require('./../public/src/utils.js'),
};
User.createGravatarURLFromEmail = function(email) {
var forceDefault = ''
if (!email) {
email = utils.generateUUID();
email = '0000',
forceDefault = '&forceDefault=y';
}
var md5sum = crypto.createHash('md5');
md5sum.update(email.toLowerCase().trim());
var gravatarURL = 'http://www.gravatar.com/avatar/' + md5sum.digest('hex') + '?default=identicon&s=128';
return gravatarURL;
var emailHash = crypto.createHash('md5').update(email.toLowerCase().trim()).digest('hex');
// @todo: https asset support?
return 'http://www.gravatar.com/avatar/' + emailHash + '?default=identicon&s=128' + forceDefault;
}
User.hashPassword = function(password, callback) {

Loading…
Cancel
Save