add validation for backend login

This commit is contained in:
Alex Holliday
2024-08-23 10:35:08 -07:00
parent 73136545cc
commit 9149f3e103
+11 -1
View File
@@ -16,7 +16,17 @@ const roleValidatior = (role) => (value, helpers) => {
//****************************************
const loginValidation = joi.object({
email: joi.string().email().required(),
email: joi
.string()
.email()
.required()
.custom((value, helpers) => {
const lowercasedValue = value.toLowerCase();
if (value !== lowercasedValue) {
return helpers.message("Email must be in lowercase");
}
return lowercasedValue;
}),
password: joi
.string()
.min(8)