From c317a3592b464f4ab8534cc9c02defeb99f979b3 Mon Sep 17 00:00:00 2001 From: jason Date: Thu, 26 Oct 2017 16:58:55 -0700 Subject: [PATCH 1/2] Allow empty strings to be set too (for removing values) --- config/param-validation.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/param-validation.js b/config/param-validation.js index 63cc111a..68b89502 100644 --- a/config/param-validation.js +++ b/config/param-validation.js @@ -6,9 +6,9 @@ export default { body: { username: Joi.string().required(), name: Joi.string().required(), - bio: Joi.string(), - website: Joi.string(), - email: Joi.string().email() + bio: Joi.string().allow(''), + website: Joi.string().allow(''), + email: Joi.string().email().allow('') }, params: { userId: Joi.string().hex().required() @@ -29,9 +29,9 @@ export default { password: Joi.string().required(), // Should be required once mobile apps get updated: name: Joi.string(), - bio: Joi.string(), - website: Joi.string(), - email: Joi.string().email() + bio: Joi.string().allow(''), + website: Joi.string().allow(''), + email: Joi.string().email().allow('') } } }; From 66aebca5ac7a7296eeed0dee68cbe13b23e89b13 Mon Sep 17 00:00:00 2001 From: jason Date: Fri, 27 Oct 2017 10:15:56 -0700 Subject: [PATCH 2/2] Delete doesn't work so setting to null --- server/controllers/user.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/controllers/user.controller.js b/server/controllers/user.controller.js index ed0dbe19..437b157f 100644 --- a/server/controllers/user.controller.js +++ b/server/controllers/user.controller.js @@ -22,7 +22,7 @@ function load(req, res, next, id) { function me(req, res, next) { User.get(req.user._id) .then((user) => { - delete user.password; + user.password = null; return res.json(user); }) .catch(e => {