openlibrary
openlibrary copied to clipboard
Add HTML validation to registration form
Closes #9244.
Feature. Adds HTML attributes to registration form inputs to prevent submission with improperly formatted data.
Technical
Implementation involved removing validate
class to prevent duplicated realtime validation, and adding appropriate attributes to inputs in forms.py
. Also involved triggering the HTML
validation manually before the grecaptcha
process, a strategy that will likely be re-used/expanded for part 2 of #9205.
Testing
- Log out (if logged in)
- Hit "Sign Up" or go to
/account/create
- Try entering an improperly formatted password, username or email
- Ignore the on-screen warning and submit the form
- Submission should be prevented and you should see an HTML built-in error message pop up next to the first badly formatted input
Screenshot
Stakeholders
@cdrini
tested on testing.openlibrary.org and I can't seem to get the email html error to appear 🤔
tested on testing.openlibrary.org and I can't seem to get the email html error to appear 🤔
Update: Fixed! Was a result of grecaptcha
blocking the validation. 🙂
@cdrini sure thing!!