Merge pull request #688 from codydaig/bugfix/github_undefined_displayname

If displayName in GitHub is undefined use username
Fixes #519
This commit is contained in:
Ilan Biala
2015-07-24 10:13:26 -04:00

View File

@@ -22,7 +22,7 @@ module.exports = function(config) {
providerData.refreshToken = refreshToken;
// Create the user OAuth profile
var displayName = profile.displayName.trim();
var displayName = profile.displayName ? profile.displayName.trim() : profile.username.trim();
var iSpace = displayName.indexOf(' '); // index of the whitespace following the firstName
var firstName = iSpace !== -1 ? displayName.substring(0, iSpace) : displayName;
var lastName = iSpace !== -1 ? displayName.substring(iSpace + 1) : '';