diff --git a/src/mailer.js b/src/mailer.js index 5a7ae4ea4..00951351f 100644 --- a/src/mailer.js +++ b/src/mailer.js @@ -92,7 +92,7 @@ function render(templateFile, params, translationAssets) { async function sendInvite(user, invitor, email, inviteLink) { assert.strictEqual(typeof user, 'object'); assert.strictEqual(typeof invitor, 'object'); - assert.strictEqual(typeof invitor, 'string'); + assert.strictEqual(typeof email, 'string'); assert.strictEqual(typeof inviteLink, 'string'); const mailConfig = await getMailConfig(); diff --git a/src/routes/users.js b/src/routes/users.js index 4a2ad7fc9..36a54351e 100644 --- a/src/routes/users.js +++ b/src/routes/users.js @@ -253,7 +253,7 @@ async function sendInviteEmail(req, res, next) { if (users.compareRoles(req.user.role, req.resource.role) < 0) return next(new HttpError(403, `role '${req.resource.role}' is required but user has only '${req.user.role}'`)); let [error] = await safe(users.sendInviteEmail(req.resource, req.body.email, AuditSource.fromRequest(req))); - if (error) return next(BoxError.toHttpError(error)); + if (error) return next(BoxError.toHttpError(error)); next(new HttpSuccess(202, {})); } diff --git a/src/users.js b/src/users.js index 2b2c4ee83..3f0a18c10 100644 --- a/src/users.js +++ b/src/users.js @@ -764,9 +764,8 @@ async function sendInviteEmail(user, email, auditSource) { assert.strictEqual(typeof user, 'object'); assert.strictEqual(typeof email, 'string'); assert.strictEqual(typeof auditSource, 'object'); - - const resetLink = await getInviteLink(user, auditSource); - await mailer.sendInvite(user, null /* invitor */, email, resetLink); + const inviteLink = await getInviteLink(user, auditSource); + await mailer.sendInvite(user, null /* invitor */, email, inviteLink); } async function setupAccount(user, data, auditSource) {