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