refs #6397 refactor
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2024-01-19 14:53:56 +01:00
parent 391f418883
commit 73e1b52348
1 changed files with 10 additions and 10 deletions

View File

@ -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];
const user = {
name: data.userName, name: data.userName,
email: firstEmail, email: firstEmail,
password: String(Math.random() * 100000000000000) password: String(Math.random() * 100000000000000)
}; };
} else
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);