fix various users-test.js
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user