openlibrary
openlibrary copied to clipboard
Add registration submission prevention for backend checks
Note: Currently a draft until #9245 is completed/merged; once 9245 is in, I'll rebase and redo the commit to reuse the logic effectively. In the meantime, I've tested locally via gitpod and it appears to be working correctly.
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 into realtime_account_validation.js
) will automatically prevent form submission, as long as they assign the input an invalid
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 https://github.com/internetarchive/openlibrary/issues/7694.
Testing
- Log out (if logged in)
- Go to "Sign Up" or
/account/create
- Fill in all the inputs, ensuring that you pass all formatting checks, but that you enter a username or email that is taken on IA or OL -- feel free to use
[email protected]
orrstesting
for testing purposes - The form should not submit
Screenshot
Stakeholders
@cdrini @mekarpeles