fix various users-test.js

This commit is contained in:
Girish Ramakrishnan
2021-07-19 12:43:30 -07:00
parent 48585e003d
commit 6e9b62dfba
4 changed files with 634 additions and 902 deletions

View File

@@ -138,11 +138,11 @@ async function activate(username, password, email, displayName, ip, auditSource)
debug(`activate: user: ${username} email:${email}`);
const [error, userObject] = await safe(users.createOwner(email, username, password, displayName, auditSource));
const [error, ownerId] = await safe(users.createOwner(email, username, password, displayName, auditSource));
if (error && error.reason === BoxError.ALREADY_EXISTS) throw new BoxError(BoxError.CONFLICT, 'Already activated');
if (error) throw error;
const token = { clientId: tokens.ID_WEBADMIN, identifier: userObject.id, expires: Date.now() + constants.DEFAULT_TOKEN_EXPIRATION_MSECS };
const token = { clientId: tokens.ID_WEBADMIN, identifier: ownerId, expires: Date.now() + constants.DEFAULT_TOKEN_EXPIRATION_MSECS };
const result = await tokens.add(token);
eventlog.add(eventlog.ACTION_ACTIVATE, auditSource, {});
@@ -150,7 +150,7 @@ async function activate(username, password, email, displayName, ip, auditSource)
setImmediate(cloudron.onActivated.bind(null, {}, NOOP_CALLBACK));
return {
userId: userObject.id,
userId: ownerId,
token: result.accessToken,
expires: result.expires
};