Make password optional

This commit is contained in:
Mel O'Hagan 2024-03-19 13:30:42 +00:00
parent 6728fdad1d
commit ff231b0095
3 changed files with 5 additions and 4 deletions

View File

@ -500,13 +500,13 @@ export class UserDB {
static async createAdminUser( static async createAdminUser(
email: string, email: string,
password: string,
tenantId: string, tenantId: string,
password?: string,
opts?: CreateAdminUserOpts opts?: CreateAdminUserOpts
) { ) {
const user: User = { const user: User = {
email: email, email: email,
password: password, password,
createdAt: Date.now(), createdAt: Date.now(),
roles: {}, roles: {},
builder: { builder: {

View File

@ -63,7 +63,7 @@ export interface SearchUsersRequest {
export interface CreateAdminUserRequest { export interface CreateAdminUserRequest {
email: string email: string
password: string password?: string
tenantId: string tenantId: string
ssoId?: string ssoId?: string
} }

View File

@ -7,12 +7,13 @@ import { users } from "../validation"
import * as selfController from "../../controllers/global/self" import * as selfController from "../../controllers/global/self"
const router: Router = new Router() const router: Router = new Router()
const OPTIONAL_STRING = Joi.string().optional().allow(null).allow("")
function buildAdminInitValidation() { function buildAdminInitValidation() {
return auth.joiValidator.body( return auth.joiValidator.body(
Joi.object({ Joi.object({
email: Joi.string().required(), email: Joi.string().required(),
password: Joi.string(), password: OPTIONAL_STRING,
tenantId: Joi.string().required(), tenantId: Joi.string().required(),
ssoId: Joi.string(), ssoId: Joi.string(),
}) })