Fix #2499 - typo in error "please enter a email" #2597
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2499
Changes:
AccountForm
andSignupForm
.Explanation:
The primary validation of this form comes from a form-level validation function. This function already checks for empty email and password and returns translated error messages.
p5.js-web-editor/client/utils/reduxFormUtils.js
Lines 33 to 35 in a1a5efd
Additionally, we have a field-level validation function which calls the
'/signup/duplicate_check'
API endpoint.p5.js-web-editor/client/modules/User/components/SignupForm.jsx
Lines 10 to 32 in a1a5efd
We don't need to call the duplicate check API if the field is empty. So we check for this and return early. But the message that we are returning there is not translated and not semantically correct ("a email" instead of "an email").
We can instead return an empty string
''
(or justreturn;
but eslint prefers the consistent string return value). Returning a falsey value instead of an error message means that this check passes and does not set an error, but that's okay because it is caught later on by the form-level validation function,validateSignup
orvalidateSettings
, where it is handled properly.Future Tasks:
duplicateCheck
function is the same in both files.I have verified that this pull request:
npm run lint
)npm run test
)develop
branch.Fixes #123