|
|
@@ -65,10 +65,12 @@ class ExternalAccount {
|
|
|
* @param {string} providerType
|
|
|
* @param {string} accountId
|
|
|
* @param {object} usernameToBeRegistered the username of User entity that will be created when accountId is not found
|
|
|
+ * @param {object} nameToBeRegistered the name of User entity that will be created when accountId is not found
|
|
|
+ * @param {object} mailToBeRegistered the mail of User entity that will be created when accountId is not found
|
|
|
* @returns {Promise<ExternalAccount>}
|
|
|
* @memberof ExternalAccount
|
|
|
*/
|
|
|
- static findOrRegister(providerType, accountId, usernameToBeRegistered, nameToBeRegistered) {
|
|
|
+ static findOrRegister(providerType, accountId, usernameToBeRegistered, nameToBeRegistered, mailToBeRegistered) {
|
|
|
|
|
|
return this.findOne({ providerType, accountId })
|
|
|
.then(account => {
|
|
|
@@ -92,7 +94,7 @@ class ExternalAccount {
|
|
|
|
|
|
// create a new User with STATUS_ACTIVE
|
|
|
debug(`ExternalAccount '${accountId}' is not found, it is going to be registered.`);
|
|
|
- return User.createUser(nameToBeRegistered, usernameToBeRegistered, undefined, undefined, undefined, User.STATUS_ACTIVE);
|
|
|
+ return User.createUser(nameToBeRegistered, usernameToBeRegistered, mailToBeRegistered, undefined, undefined, User.STATUS_ACTIVE);
|
|
|
})
|
|
|
.then(newUser => {
|
|
|
return this.associate(providerType, accountId, newUser);
|