Allowing null for global user endpoint properties.
This commit is contained in:
parent
14b62b8aed
commit
31d3566626
|
@ -102,6 +102,9 @@ exports.self = async ctx => {
|
||||||
if (ctx.request.body.password) {
|
if (ctx.request.body.password) {
|
||||||
ctx.request.body.password = await hash(ctx.request.body.password)
|
ctx.request.body.password = await hash(ctx.request.body.password)
|
||||||
}
|
}
|
||||||
|
// don't allow sending up an ID/Rev, always use the existing one
|
||||||
|
delete ctx.request.body._id
|
||||||
|
delete ctx.request.body._rev
|
||||||
const response = await db.put({
|
const response = await db.put({
|
||||||
...user,
|
...user,
|
||||||
...ctx.request.body,
|
...ctx.request.body,
|
||||||
|
|
|
@ -7,10 +7,10 @@ const router = Router()
|
||||||
|
|
||||||
function buildUserSaveValidation(isSelf = false) {
|
function buildUserSaveValidation(isSelf = false) {
|
||||||
let schema = {
|
let schema = {
|
||||||
email: Joi.string(),
|
email: Joi.string().allow(null, ""),
|
||||||
password: Joi.string().allow(null, ""),
|
password: Joi.string().allow(null, ""),
|
||||||
firstName: Joi.string(),
|
firstName: Joi.string().allow(null, ""),
|
||||||
lastName: Joi.string(),
|
lastName: Joi.string().allow(null, ""),
|
||||||
builder: Joi.object({
|
builder: Joi.object({
|
||||||
global: Joi.boolean().optional(),
|
global: Joi.boolean().optional(),
|
||||||
apps: Joi.array().optional(),
|
apps: Joi.array().optional(),
|
||||||
|
|
Loading…
Reference in New Issue