Add backend validation to check for lowercase

This commit is contained in:
Alex Holliday committed 2024-08-23 10:33:37 -07:00
1 parent ee22216bf9
commit 73136545cc
2 files changed
+12 -1

No files matched your search

+1
View File
@@ -3,3 +3,4 @@
mongo/data/* mongo/data/*
redis/data/* redis/data/*
*.env *.env
certbot/*
+11 -1
View File
@@ -35,7 +35,17 @@ const registerValidation = joi.object({
.string() .string()
.required() .required()
.pattern(/^[A-Za-z]+$/), .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 password: joi
.string() .string()
.min(8) .min(8)