Safe reference Facebook profile location

pull/2/head
Sahat Yalkabov 2014-02-04 13:28:27 -05:00
parent f56bd90dce
commit 1cc0bb4526
1 changed files with 2 additions and 2 deletions

View File

@ -68,7 +68,7 @@ passport.use(new FacebookStrategy(secrets.facebook, function (req, accessToken,
user.profile.name = profile.displayName; user.profile.name = profile.displayName;
user.profile.gender = profile._json.gender; user.profile.gender = profile._json.gender;
user.profile.picture = 'https://graph.facebook.com/' + profile.id + '/picture?type=large'; user.profile.picture = 'https://graph.facebook.com/' + profile.id + '/picture?type=large';
user.profile.location = profile._json.location.name; user.profile.location = (profile._json.location) ? profile._json.location.name : '';
user.save(function(err) { user.save(function(err) {
done(err, user); done(err, user);
}); });
@ -150,7 +150,7 @@ passport.use(new TwitterStrategy(secrets.twitter, function(req, accessToken, tok
var user = new User(); var user = new User();
// Twitter will not provide an email address. Period. // Twitter will not provide an email address. Period.
// But a persons twitter username is guaranteed to be unique // But a persons twitter username is guaranteed to be unique
// so we can “fake” a twitter email address as follows: // so we can "fake" a twitter email address as follows:
user.email = profile.username + "@twitter.com"; user.email = profile.username + "@twitter.com";
user.twitter = profile.id; user.twitter = profile.id;
user.tokens.push({ kind: 'twitter', accessToken: accessToken, tokenSecret: tokenSecret }); user.tokens.push({ kind: 'twitter', accessToken: accessToken, tokenSecret: tokenSecret });