fixed #31 - twitter profile picture now used as nodebb avatar in lieu of

email address for gravatar
v1.18.x
Julian Lam 12 years ago
parent 762cecf1c3
commit bea5dff563

@ -9,6 +9,10 @@
display: inline-block;
text-align: center;
font-size: 12px;
.stats {
clear: both;
}
}
li {

@ -80,8 +80,10 @@
<a href="/users/{posts.userslug}">
<img src="{posts.picture}" align="left" class="img-polaroid"/>
</a>
<i class="icon-star"></i><span class="user_rep_{posts.uid} formatted-number">{posts.user_rep}</span>
<div id="ids_{posts.pid}_{posts.uid}" class="chat hidden-phone" title="Chat"><i class="icon-comment"></i></div>
<div class="stats">
<i class="icon-star"></i><span class="user_rep_{posts.uid} formatted-number">{posts.user_rep}</span>
<div id="ids_{posts.pid}_{posts.uid}" class="chat hidden-phone" title="Chat"><i class="icon-comment"></i></div>
</div>
</div>
<div class="span11">
<div class="post-block">

@ -53,7 +53,7 @@ var user = require('./user.js'),
}
}
Login.loginViaTwitter = function(twid, handle, callback) {
Login.loginViaTwitter = function(twid, handle, photos, callback) {
user.get_uid_by_twitter_id(twid, function(uid) {
if (uid !== null) {
// Existing User
@ -69,6 +69,13 @@ var user = require('./user.js'),
// Save twitter-specific information to the user
user.setUserField(uid, 'twid', twid);
RDB.hset('twid:uid', twid, uid);
// Save their photo, if present
if (photos && photos.length > 0) {
user.setUserField(uid, 'uploadedpicture', photos[0].value);
user.setUserField(uid, 'picture', photos[0].value);
}
callback(null, {
uid: uid
});

@ -22,7 +22,7 @@
consumerSecret: global.config['social:twitter:secret'],
callbackURL: nconf.get('url') + 'auth/twitter/callback'
}, function(token, tokenSecret, profile, done) {
login_module.loginViaTwitter(profile.id, profile.username, function(err, user) {
login_module.loginViaTwitter(profile.id, profile.username, profile.photos, function(err, user) {
if (err) { return done(err); }
done(null, user);
});

Loading…
Cancel
Save