openlibrary
openlibrary copied to clipboard
Move registration field formatting checks from backend -> frontend
Dependency to epic
#7694.
For the realtime validation in realtime_account_validation.js
, a number of simple formatting checks (such as screenname length and email format) unnecessarily happen in the API validation endpoint in account.py
.
Describe the problem that you'd like solved
Since we're now adding frontend password format validation to realtime_account_validation.js
and the requisite i18n
strings to create.html
, and to avoid making unnecessary calls to the API, I propose we move all the other formatting checks into realtime_account_validation.js
so that the API call only happens if those checks pass.
Proposal & Constraints
- Prepare all necessary error messages strings in
create.html
, per the JS internationalization process - Add relevant if-conditions and return statements to
realtime_account_validation.js
(including the email spam checks fromforms.py
) so that all formatting checks run before the API call
This will also be a helpful preparatory step for the JS form submission prevention step of #9205.
Additional context
Stakeholders
@cdrini
Closing this for now to determine whether necessary and pick back up later as part of the refactor process if so!
Closed as completed by #9485.