From 1fd3bb9b4748afaeef98785c70f362a0e4831433 Mon Sep 17 00:00:00 2001 From: Haris Razis Date: Sun, 10 Jan 2021 11:19:35 +0200 Subject: [PATCH] Fix celebrate only accepting strings as password --- server/schemas/joi.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/server/schemas/joi.js b/server/schemas/joi.js index ee9eac2..8cf895f 100644 --- a/server/schemas/joi.js +++ b/server/schemas/joi.js @@ -1,7 +1,7 @@ const {Joi} = require('celebrate'); const guid = { - params:{ + params: { userId: Joi.string().guid().required() } } @@ -14,14 +14,18 @@ const userAuthSchema = { }; const userUpdateSchema = { - body: { - _id: Joi.string().required(), - username: Joi.string().required(), - email: Joi.any(), - password: Joi.string().allow(''), - newPassword: Joi.string().allow(''), + body: { + _id: Joi.string().required(), + username: Joi.string().required(), + __v: Joi.number().integer(), + email: Joi.string().email(), + registered: Joi.string(), + lastLogin: Joi.string(), + password: Joi.string().alphanum().allow(''), + newPassword: Joi.string().alphanum().allow(''), + } } -}; +; const athleteUpdateSchema = { body: {