diff --git a/config/strategies/github.js b/config/strategies/github.js index 7c36ba09d4..97c7c76727 100644 --- a/config/strategies/github.js +++ b/config/strategies/github.js @@ -23,8 +23,15 @@ module.exports = function() { providerData.refreshToken = refreshToken; // Create the user OAuth profile + var displayName = profile.displayName.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) : ''; + var providerUserProfile = { - displayName: profile.displayName, + firstName: firstName, + lastName: lastName, + displayName: displayName, email: profile.emails[0].value, username: profile.username, provider: 'github', diff --git a/config/strategies/twitter.js b/config/strategies/twitter.js index 8e250eeba3..2bc57cb259 100644 --- a/config/strategies/twitter.js +++ b/config/strategies/twitter.js @@ -23,8 +23,15 @@ module.exports = function() { providerData.tokenSecret = tokenSecret; // Create the user OAuth profile + var displayName = profile.displayName.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) : ''; + var providerUserProfile = { - displayName: profile.displayName, + firstName: firstName, + lastName: lastName, + displayName: displayName, username: profile.username, provider: 'twitter', providerIdentifierField: 'id_str',