diff --git a/config/passport.js b/config/passport.js index c10c13fed80..e086c1e2a20 100755 --- a/config/passport.js +++ b/config/passport.js @@ -68,7 +68,7 @@ passport.use(new FacebookStrategy(secrets.facebook, function (req, accessToken, user.profile.name = profile.displayName; user.profile.gender = profile._json.gender; 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) { done(err, user); }); @@ -150,7 +150,7 @@ passport.use(new TwitterStrategy(secrets.twitter, function(req, accessToken, tok var user = new User(); // Twitter will not provide an email address. Period. // But a person’s 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.twitter = profile.id; user.tokens.push({ kind: 'twitter', accessToken: accessToken, tokenSecret: tokenSecret });