From 664323e911ebc93887df1d3933d243533ff7f08b Mon Sep 17 00:00:00 2001 From: sundowndev Date: Thu, 15 Nov 2018 19:27:29 +0100 Subject: [PATCH] Email field --- app/schemas/user.js | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 app/schemas/user.js diff --git a/app/schemas/user.js b/app/schemas/user.js deleted file mode 100644 index 16dae6a..0000000 --- a/app/schemas/user.js +++ /dev/null @@ -1,25 +0,0 @@ -const Joi = require('joi'); - -module.exports = (req, res, next) => { - const schema = Joi.object().keys({ - firstname: Joi.string().min(2).required(), - lastname: Joi.string().min(2).required(), - username: Joi.string().alphanum().min(3).max(30) - .required(), - password: Joi.string().required(), - }); - - Joi.validate({ - firstname: req.body.firstname, - lastname: req.body.lastname, - username: req.body.username, - password: req.body.password, - }, - schema, (validateErr) => { - if (validateErr) { - return next({ status: 400, message: 'Form is invalid.', error: validateErr }); - } - - return next(); - }); -};