From 46d7eab105630ccf2e8149369fd297a56b68e511 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Mon, 13 Jun 2022 22:26:15 +0100 Subject: [PATCH] Fix user id generation --- packages/backend-core/src/db/utils.ts | 2 +- packages/worker/src/sdk/users/users.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend-core/src/db/utils.ts b/packages/backend-core/src/db/utils.ts index 7e95b7df97..dc7a0454c3 100644 --- a/packages/backend-core/src/db/utils.ts +++ b/packages/backend-core/src/db/utils.ts @@ -86,7 +86,7 @@ export function getWorkspaceParams(id = "", otherProps = {}) { * Generates a new global user ID. * @returns {string} The new user ID which the user doc can be stored under. */ -export function generateGlobalUserID(id: any) { +export function generateGlobalUserID(id?: any) { return `${DocumentTypes.USER}${SEPARATOR}${id || newid()}` } diff --git a/packages/worker/src/sdk/users/users.ts b/packages/worker/src/sdk/users/users.ts index cb2b439c7b..c2e29c7dae 100644 --- a/packages/worker/src/sdk/users/users.ts +++ b/packages/worker/src/sdk/users/users.ts @@ -108,7 +108,7 @@ export const save = async ( throw "Password must be specified." } - _id = _id || dbUtils.generateGlobalUserID(email) + _id = _id || dbUtils.generateGlobalUserID() user = { createdAt: Date.now(), ...dbUser,