From 61204f61be9f4f0a7a29f3e973d3de49d3e1ad3a Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Fri, 9 Jan 2015 14:31:49 -0800 Subject: [PATCH] auto populate twitter attribute if you log in with twitter --- config/passport.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/passport.js b/config/passport.js index d8a04146b791e8..635362d1b02b0c 100644 --- a/config/passport.js +++ b/config/passport.js @@ -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); @@ -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); });