diff --git a/packages/backend-core/src/users/db.ts b/packages/backend-core/src/users/db.ts index 136cb4b8ad..04d3264e6f 100644 --- a/packages/backend-core/src/users/db.ts +++ b/packages/backend-core/src/users/db.ts @@ -500,13 +500,13 @@ export class UserDB { static async createAdminUser( email: string, - password: string, tenantId: string, + password?: string, opts?: CreateAdminUserOpts ) { const user: User = { email: email, - password: password, + password, createdAt: Date.now(), roles: {}, builder: { diff --git a/packages/types/src/api/web/user.ts b/packages/types/src/api/web/user.ts index 0de42622e6..d68d687dcb 100644 --- a/packages/types/src/api/web/user.ts +++ b/packages/types/src/api/web/user.ts @@ -63,7 +63,7 @@ export interface SearchUsersRequest { export interface CreateAdminUserRequest { email: string - password: string + password?: string tenantId: string ssoId?: string } diff --git a/packages/worker/src/api/routes/global/users.ts b/packages/worker/src/api/routes/global/users.ts index 3c9cfd2f41..6b9291b88b 100644 --- a/packages/worker/src/api/routes/global/users.ts +++ b/packages/worker/src/api/routes/global/users.ts @@ -7,12 +7,13 @@ import { users } from "../validation" import * as selfController from "../../controllers/global/self" const router: Router = new Router() +const OPTIONAL_STRING = Joi.string().optional().allow(null).allow("") function buildAdminInitValidation() { return auth.joiValidator.body( Joi.object({ email: Joi.string().required(), - password: Joi.string(), + password: OPTIONAL_STRING, tenantId: Joi.string().required(), ssoId: Joi.string(), })