internetarchive / openlibrary

One webpage for every book ever published!
https://openlibrary.org
GNU Affero General Public License v3.0
5.13k stars 1.35k forks source link

Move registration field formatting checks from backend -> frontend #9203

Closed rebecca-shoptaw closed 2 months ago

rebecca-shoptaw commented 5 months ago

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

  1. Prepare all necessary error messages strings in create.html, per the JS internationalization process
  2. Add relevant if-conditions and return statements to realtime_account_validation.js (including the email spam checks from forms.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

rebecca-shoptaw commented 5 months ago

Closing this for now to determine whether necessary and pick back up later as part of the refactor process if so!

rebecca-shoptaw commented 2 months ago

Closed as completed by #9485.