From 5fc7c6d80b67322098844762dfecb4e5ab901e48 Mon Sep 17 00:00:00 2001 From: mperezsa <19-mperezsa@users.noreply.022e47118ec0> Date: Thu, 25 Nov 2021 12:51:47 +0000 Subject: [PATCH] Upload New File --- .../registration/validateRegistration.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 PROF-XXI FW Tool/client/src/components/pages/validation/registration/validateRegistration.js diff --git a/PROF-XXI FW Tool/client/src/components/pages/validation/registration/validateRegistration.js b/PROF-XXI FW Tool/client/src/components/pages/validation/registration/validateRegistration.js new file mode 100644 index 0000000..a5f5d2c --- /dev/null +++ b/PROF-XXI FW Tool/client/src/components/pages/validation/registration/validateRegistration.js @@ -0,0 +1,22 @@ +export default function validateRegistration(user) { + let errors = {}; + + if (user.firstName === "") { + errors.firstName = "Username is Required"; + } + + if (user.organizationName === "") { + errors.organizationName = "Official name of organization is Required"; + } + + if (user.email === "") { + errors.email = "Email is Required"; + } else if (!/\S+@\S+\.\S+/.test(user.email)) { + errors.email = "Email Address is Invalid"; + } + + if (user.password === "") { + errors.password = "Password is Required"; + } + return errors; +} -- GitLab