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 0000000000000000000000000000000000000000..a5f5d2ca272a36b3e36ec5ba4ba4d8a2de36a8af --- /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; +}