From df335b00878b0aa4083635bcc690422fde027289 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Tue, 30 Dec 2014 16:55:54 -0800 Subject: [PATCH] Revert "modify twitter auth to fail if mismatch between selected user and current user" This reverts commit f75d305939d5494f0e21c9521e7572522e0c16c8. --- config/passport.js | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/config/passport.js b/config/passport.js index 4553e327b9..ab1c7426a3 100644 --- a/config/passport.js +++ b/config/passport.js @@ -109,32 +109,26 @@ passport.use( } else { User.findOne({ twitter: profile.id }, function(err, existingUser) { if (err) { return done(err); } - if (!existingUser || (existingUser && existingUser.twitter == profile.id)) { - var user = existingUser || new User(); - user.twitter = profile.id; - user.email = user.email || ''; - user.tokens.push({ - kind: 'twitter', - accessToken: accessToken, - tokenSecret: tokenSecret - }); - user.profile.name = user.profile.name || profile.displayName; - user.profile.username = user.profile.username || profile.username; + var user = existingUser || new User(); + user.twitter = profile.id; + user.email = user.email || ''; + user.tokens.push({ + kind: 'twitter', + accessToken: accessToken, + tokenSecret: tokenSecret + }); + user.profile.name = user.profile.name || profile.displayName; + user.profile.username = user.profile.username || profile.username; - user.profile.location = - user.profile.location || profile._json.location; - user.profile.picture = - user.profile.picture || profile._json.profile_image_url_https; + user.profile.location = + user.profile.location || profile._json.location; + user.profile.picture = + user.profile.picture || profile._json.profile_image_url_https; - user.save(function (err) { - if (err) { - return done(err); - } - done(null, user); - }); - } else { - return done("Sorry, we experienced an error. This has been reported. Try logging in with a different authentication method."); - } + user.save(function(err) { + if (err) { return done(err); } + done(null, user); + }); }); } })