Closed mbeps closed 1 year ago
The snippet bellow can be inserted into onSubmit
in src/components/Modal/Auth/Signup.tsx
.
This will check whether:
if (
signUpForm.password.length < 8 ||
!/\d/.test(signUpForm.password) ||
!/[!@#$%^&*(),.?":{}|<>]/.test(signUpForm.password) ||
!/[A-Z]/.test(signUpForm.password)
) {
// If the password doesn't meet the requirements
setError("Password must be at least 8 characters long, contain at least 1 number and special character and at least 1 capital letter"); // Set error
return; // Return so that the function doesn't continue
}
Separating each requirement would be better as it would allow the user to know exactly which requirement was not met. The current implementation is confusing as the user may not know immediately why the requirement was not met.
if (signUpForm.password.length < 8) {
setError("Password must be at least 8 characters long");
return;
}
if (!/\d/.test(signUpForm.password)) {
setError("Password must contain at least 1 number");
return;
}
if (!/[!@#$%^&*(),.?":{}|<>]/.test(signUpForm.password)) {
setError("Password must contain at least 1 special character");
return;
}
if (!/[A-Z]/.test(signUpForm.password)) {
setError("Password must contain at least 1 capital letter");
return;
}
Describe the bug
When entering an inappropriate password (too short), the system does not display any errors and there is no clean message informing the user whether the account has been created or not.
Reproducing the bug
new1
Expected behavior
Screenshots
Platforms
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Severity: