This commit is contained in:
parent
391f418883
commit
73e1b52348
|
@ -31,16 +31,16 @@ module.exports = function(Self) {
|
||||||
myOptions.transaction = tx;
|
myOptions.transaction = tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
let user;
|
if (!data.email)
|
||||||
if (data.email) {
|
throw new UserError('An email is necessary');
|
||||||
const firstEmail = data.email ? data.email.split(',')[0] : null;
|
|
||||||
user = {
|
const firstEmail = data.email.split(',')[0];
|
||||||
name: data.userName,
|
|
||||||
email: firstEmail,
|
const user = {
|
||||||
password: String(Math.random() * 100000000000000)
|
name: data.userName,
|
||||||
};
|
email: firstEmail,
|
||||||
} else
|
password: String(Math.random() * 100000000000000)
|
||||||
throw new UserError(`An email is necessary`);
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const account = await models.VnUser.create(user, myOptions);
|
const account = await models.VnUser.create(user, myOptions);
|
||||||
|
|
Loading…
Reference in New Issue