diff options
author | Julien Dessaux | 2022-11-22 22:55:36 +0100 |
---|---|---|
committer | Julien Dessaux | 2022-11-22 22:55:36 +0100 |
commit | 038c877aed55cffdb4401a4c7e7b15b113798145 (patch) | |
tree | e2902779e76ba8bd60b63be0e512a3c112530d68 /utils/checks.js | |
parent | Added basic games handling (diff) | |
download | jeux-de-mots-038c877aed55cffdb4401a4c7e7b15b113798145.tar.gz jeux-de-mots-038c877aed55cffdb4401a4c7e7b15b113798145.tar.bz2 jeux-de-mots-038c877aed55cffdb4401a4c7e7b15b113798145.zip |
Implemented game creation
Diffstat (limited to 'utils/checks.js')
-rw-r--r-- | utils/checks.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/utils/checks.js b/utils/checks.js new file mode 100644 index 0000000..85c51df --- /dev/null +++ b/utils/checks.js @@ -0,0 +1,15 @@ +import { check } from "express-validator"; + +export const checkName = check("name") + .trim() + .matches(/^[a-z][-a-z0-9_]+$/i) + .withMessage("Un identifiant d'au moins deux charactères est requis."); + +export const checkPassword = check("password") + .isStrongPassword() + .withMessage("Veuillez utiliser un mot de passe d'au moins 8 caractères contenant au moins une minuscule, majuscule, chiffre et charactère spécial."); + +export const checkUsername = check("username") + .trim() + .matches(/^[a-z][-a-z0-9_]+$/i) + .withMessage("Un identifiant d'au moins deux charactères est requis."); |