Allow null for firstName and lastName (#11482)
This commit is contained in:
parent
85903a2a30
commit
a5fb25e41e
|
@ -1,12 +1,14 @@
|
||||||
import { auth } from "@budibase/backend-core"
|
import { auth } from "@budibase/backend-core"
|
||||||
import Joi from "joi"
|
import Joi from "joi"
|
||||||
|
|
||||||
|
const OPTIONAL_STRING = Joi.string().allow(null, "")
|
||||||
|
|
||||||
let schema: any = {
|
let schema: any = {
|
||||||
email: Joi.string().allow(null, ""),
|
email: OPTIONAL_STRING,
|
||||||
password: Joi.string().allow(null, ""),
|
password: OPTIONAL_STRING,
|
||||||
forceResetPassword: Joi.boolean().optional(),
|
forceResetPassword: Joi.boolean().optional(),
|
||||||
firstName: Joi.string().allow(null, ""),
|
firstName: OPTIONAL_STRING,
|
||||||
lastName: Joi.string().allow(null, ""),
|
lastName: OPTIONAL_STRING,
|
||||||
builder: Joi.object({
|
builder: Joi.object({
|
||||||
global: Joi.boolean().optional(),
|
global: Joi.boolean().optional(),
|
||||||
apps: Joi.array().optional(),
|
apps: Joi.array().optional(),
|
||||||
|
@ -21,8 +23,8 @@ export const buildSelfSaveValidation = () => {
|
||||||
schema = {
|
schema = {
|
||||||
password: Joi.string().optional(),
|
password: Joi.string().optional(),
|
||||||
forceResetPassword: Joi.boolean().optional(),
|
forceResetPassword: Joi.boolean().optional(),
|
||||||
firstName: Joi.string().allow("").optional(),
|
firstName: OPTIONAL_STRING,
|
||||||
lastName: Joi.string().allow("").optional(),
|
lastName: OPTIONAL_STRING,
|
||||||
onboardedAt: Joi.string().optional(),
|
onboardedAt: Joi.string().optional(),
|
||||||
}
|
}
|
||||||
return auth.joiValidator.body(Joi.object(schema).required().unknown(false))
|
return auth.joiValidator.body(Joi.object(schema).required().unknown(false))
|
||||||
|
|
Loading…
Reference in New Issue