mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 16:30:34 +01:00
closes #73
This commit is contained in:
@@ -38,7 +38,7 @@ marked.setOptions({
|
|||||||
post.username = userData.username || 'anonymous';
|
post.username = userData.username || 'anonymous';
|
||||||
post.userslug = userData.userslug || '';
|
post.userslug = userData.userslug || '';
|
||||||
post.user_rep = userData.reputation || 0;
|
post.user_rep = userData.reputation || 0;
|
||||||
post.picture = userData.picture || 'http://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e';
|
post.picture = userData.picture || require('gravatar').url('', {}, https=global.config.https);
|
||||||
post.signature = marked(userData.signature || '');
|
post.signature = marked(userData.signature || '');
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
|
|||||||
17
src/user.js
17
src/user.js
@@ -338,16 +338,19 @@ var utils = require('./../public/src/utils.js'),
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
User.createGravatarURLFromEmail = function(email) {
|
User.createGravatarURLFromEmail = function(email) {
|
||||||
var forceDefault = ''
|
var options = {
|
||||||
|
size: '128',
|
||||||
|
default: 'identicon',
|
||||||
|
rating: 'pg'
|
||||||
|
};
|
||||||
|
|
||||||
if (!email) {
|
if (!email) {
|
||||||
email = '0000',
|
email = '';
|
||||||
forceDefault = '&forceDefault=y';
|
options.forcedefault = 'y';
|
||||||
}
|
}
|
||||||
var emailHash = crypto.createHash('md5').update(email.toLowerCase().trim()).digest('hex');
|
|
||||||
// @todo: https asset support?
|
return require('gravatar').url(email, options, https=global.config.https);
|
||||||
return 'http://www.gravatar.com/avatar/' + emailHash + '?default=identicon&s=128' + forceDefault;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
User.hashPassword = function(password, callback) {
|
User.hashPassword = function(password, callback) {
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ var express = require('express'),
|
|||||||
auth.initialize(app);
|
auth.initialize(app);
|
||||||
|
|
||||||
app.use(function(req, res, next) {
|
app.use(function(req, res, next) {
|
||||||
|
|
||||||
|
global.config.https = req.connection.encrypted !== undefined;
|
||||||
|
|
||||||
// Don't bother with session handling for API requests
|
// Don't bother with session handling for API requests
|
||||||
if (/^\/api\//.test(req.url)) return next();
|
if (/^\/api\//.test(req.url)) return next();
|
||||||
|
|
||||||
@@ -261,9 +264,13 @@ var express = require('express'),
|
|||||||
app.get('/test', function(req, res) {
|
app.get('/test', function(req, res) {
|
||||||
|
|
||||||
console.log('derp');
|
console.log('derp');
|
||||||
user.get_userslugs_by_uids([1,2], function(data) {
|
/*user.get_userslugs_by_uids([1,2], function(data) {
|
||||||
res.send(data);
|
res.send(data);
|
||||||
});
|
});*/
|
||||||
|
var gravatar= require('gravatar');
|
||||||
|
var img = gravatar.url('', {}, https=false);
|
||||||
|
res.send(img);
|
||||||
|
// 'http://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e'
|
||||||
|
|
||||||
/* categories.getCategoryById(1,1, function(data) {
|
/* categories.getCategoryById(1,1, function(data) {
|
||||||
res.send(data);
|
res.send(data);
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
|
|||||||
uid:0,
|
uid:0,
|
||||||
username: "Anonymous User",
|
username: "Anonymous User",
|
||||||
email: '',
|
email: '',
|
||||||
picture: 'http://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?s=24'
|
picture: require('gravatar').url('', {s:'24'}, https=global.config.https)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user