Make password optional
This commit is contained in:
parent
6728fdad1d
commit
ff231b0095
|
@ -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: {
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(),
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue