Skip to content

Commit

Permalink
auto populate twitter attribute if you log in with twitter
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Q Larson committed Jan 9, 2015
1 parent 372610e commit 61204f6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ passport.use(new TwitterStrategy(secrets.twitter, function(req, accessToken, tok
user.profile.name = user.profile.name || profile.displayName;
user.profile.location = user.profile.location || profile._json.location;
user.profile.picture = user.profile.picture || profile._json.profile_image_url_https.replace('_normal', '');
user.profile.twitterHandle = user.profile.twitterHandle || profile.username;
user.save(function(err) {
req.flash('info', { msg: 'Twitter account has been linked.' });
done(err, user);
Expand All @@ -227,6 +228,7 @@ passport.use(new TwitterStrategy(secrets.twitter, function(req, accessToken, tok
user.profile.name = profile.displayName;
user.profile.location = profile._json.location;
user.profile.picture = profile._json.profile_image_url_https.replace('_normal', '');
user.profile.twitterHandle = user.profile.twitterHandle || profile.username;
user.save(function(err) {
done(err, user);
});
Expand Down

0 comments on commit 61204f6

Please sign in to comment.