mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 00:15:46 +01:00
fixed #31 - twitter profile picture now used as nodebb avatar in lieu of
email address for gravatar
This commit is contained in:
@@ -9,6 +9,10 @@
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
|
||||
.stats {
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
|
||||
li {
|
||||
|
||||
@@ -80,9 +80,11 @@
|
||||
<a href="/users/{posts.userslug}">
|
||||
<img src="{posts.picture}" align="left" class="img-polaroid"/>
|
||||
</a>
|
||||
<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">
|
||||
<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) {
|
||||
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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user