diff --git a/packages/auth/src/middleware/passport/local.js b/packages/auth/src/middleware/passport/local.js index 5a2221499a..2984d2d7e3 100644 --- a/packages/auth/src/middleware/passport/local.js +++ b/packages/auth/src/middleware/passport/local.js @@ -39,6 +39,7 @@ exports.authenticate = async function(username, password, done) { if (await compare(password, dbUser.password)) { const payload = { userId: dbUser._id, + builder: dbUser.builder, } const token = jwt.sign(payload, process.env.JWT_SECRET, { diff --git a/packages/worker/src/api/routes/admin/index.js b/packages/worker/src/api/routes/admin/index.js index 2d46174c68..77c46278d1 100644 --- a/packages/worker/src/api/routes/admin/index.js +++ b/packages/worker/src/api/routes/admin/index.js @@ -14,15 +14,15 @@ function buildUserSaveValidation() { email: Joi.string(), password: Joi.string().allow(null, ""), builder: Joi.object({ - global: Joi.boolean().allow(undefined), - apps: Joi.array().allow(undefined), - }).unknown(true).allow(undefined), + global: Joi.boolean().optional(), + apps: Joi.array().optional(), + }).unknown(true).optional(), // maps appId -> roleId for the user roles: Joi.object() .pattern(/.*/, Joi.string()) .required() .unknown(true) - }).required().unknown(true).allow(undefined)) + }).required().unknown(true).optional()) } router