Vulcan/lib/gravatar.js
Ali Elouafiq 12c18e0119 adding Facebook Login
and a fancy favicon
2014-05-04 17:21:52 +01:00

23 lines
No EOL
753 B
JavaScript

// super, super simple
Gravatar = {
getGravatar: function(user, options) {
if(user.email_hash){
var options = options || {};
var protocol = options.secure ? 'https' : 'http';
delete options.secure;
var hash = user.email_hash;
var url = protocol + '://www.gravatar.com/avatar/' + hash;
var params = _.map(options, function(val, key) { return key + "=" + val}).join('&');
if (params !== '')
url += '?' + params;
return url;
}else if(user.services && user.services.twitter){
return 'http://demo.telesc.pe/img/default_avatar.png';
//return user.services.twitter.profile_image_url; //for the oauth-login avatar, diff for diff oauth, maybe it could be better
}
}
}