twitter username now persisted

This commit is contained in:
Michael Q Larson
2014-10-13 21:38:10 -07:00
parent 254740c065
commit 2106cbdbf2
4 changed files with 45 additions and 25 deletions

View File

@@ -64,7 +64,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;
user.profile.username = profile.displayName;
user.profile.username = profile.username;
user.save(function(err) {
req.flash('info', { msg: 'Twitter account has been linked.' });
done(err, user);
@@ -86,6 +86,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;
user.profile.username = profile.username;
user.save(function(err) {
done(err, user);
});