Closed lakshya-20 closed 4 years ago
Working on this
File in /src/TopMenu.js
Updated and added: Check on name lenght and then test on String email via RegEx expression
const handleRegister = e => {
e.preventDefault();
if(name.length <= 3){
setAlert('Name should not be of length less than 3.', 'danger');
}
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
re.test(String(email).toLocaleLowerCase);
if(re.test(email) == false){
setAlert('Not valid email address!', 'danger');
}
if (name === '' || email === '' || password === '') {
setAlert('Please fill in all fields', 'danger');
} else {
console.log('register called');
showLoading({ data: true });
register({
name,
email,
password
});
}
};
Can it be considered as fix for this issue?
I'll be happy to contribute.
Can it be considered as fix for this issue?
Yes, it's working fine! Thanks
Add input validation of the data received while creating a new account to ensure only properly formed data is entering the workflow.
Entries to be verified: