diff --git a/common/models/User-Identity.js b/common/models/User-Identity.js index 7aa88b295ec981..3b1bcb8750ce28 100644 --- a/common/models/User-Identity.js +++ b/common/models/User-Identity.js @@ -158,14 +158,14 @@ export default function(UserIdent) { userChanged = true; } - if (!(/github/).test(provider)) { + if (!(/github/).test(provider) && profile) { debug('setting social', provider, (/github/g).test(provider)); debug('profile username', profile.username); user[provider] = profile.username; } // if user signed in with github refresh their info - if (/github/.test(provider)) { + if (/github/.test(provider) && profile && profile._json) { debug("user isn't github cool or username from github is different"); setProfileFromGithub(user, profile, profile._json); userChanged = true;