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; display: inline-block;
text-align: center; text-align: center;
font-size: 12px; font-size: 12px;
.stats {
clear: both;
}
} }
li { li {

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

@ -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) { user.get_uid_by_twitter_id(twid, function(uid) {
if (uid !== null) { if (uid !== null) {
// Existing User // Existing User
@ -69,6 +69,13 @@ var user = require('./user.js'),
// Save twitter-specific information to the user // Save twitter-specific information to the user
user.setUserField(uid, 'twid', twid); user.setUserField(uid, 'twid', twid);
RDB.hset('twid:uid', twid, uid); 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, { callback(null, {
uid: uid uid: uid
}); });

@ -22,7 +22,7 @@
consumerSecret: global.config['social:twitter:secret'], consumerSecret: global.config['social:twitter:secret'],
callbackURL: nconf.get('url') + 'auth/twitter/callback' callbackURL: nconf.get('url') + 'auth/twitter/callback'
}, function(token, tokenSecret, profile, done) { }, 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); } if (err) { return done(err); }
done(null, user); done(null, user);
}); });

Loading…
Cancel
Save