Add registration submission prevention for backend checks #9267
+5
−1
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.
Closes #9264.
Feature. Prevents registration form submission if any inputs are invalid -- covers taken username/screenname errors which would otherwise pass HTML checks and allow submission.
Technical
Adds an extra validity check (determining that no form inputs are invalid) before allowing form submission. This means that inputs that are invalid because they failed backend IA/OL availability checks, but passed
HTML
formatting tests, will still be caught and prevent form submission.This strategy has the added advantage of ensuring any future
JavaScript
-based checks (i.e. if we move the email spamcheck intorealtime_account_validation.js
) will automatically prevent form submission, as long as they assign the input aninvalid
class.As noted in the issue, this won't display helpful new error messages the way the HTML checks does, but further UI customization (i.e. highlighting existing error messages) could be included in the UI phase of #7694.
Also has a nice side effect of handling the edge case in where a user's browser doesn't support
reportValidity
-- if their submission has formatting issues, they won't see the nice HTML errors, but they still won't be able to submit.Also added a few comments to explain what these checks do to prevent future developers removing seemingly duplicative checks.
Testing
/account/create
rebecca@rebeccashoptaw.dev
orrstesting
for testing purposesScreenshot
Stakeholders
@cdrini @mekarpeles