Add backend validation to check for lowercase

This commit is contained in:
Alex Holliday
2024-08-23 10:33:37 -07:00
parent ee22216bf9
commit 73136545cc
2 changed files with 13 additions and 2 deletions

3
Docker/.gitignore vendored
View File

@@ -2,4 +2,5 @@
!build_images.sh
mongo/data/*
redis/data/*
*.env
*.env
certbot/*

View File

@@ -35,7 +35,17 @@ const registerValidation = joi.object({
.string()
.required()
.pattern(/^[A-Za-z]+$/),
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)