feat(contacts): validate Website field and cap text fields on company form #216
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/mapps-213-company-form-website-validation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The New Company form accepted any Website value (including javascript:/data:/vbscript: and malformed URLs) client-side and only failed as an opaque "Request failed with status: 422" with no field highlight. Free-text fields also accepted unbounded input.
Add validate_website_field: blank stays optional, otherwise require an explicit http/https scheme and a non-empty host, rejecting dangerous schemes and malformed URLs at the field before any request. Scheme detection is factored into a shared utils::url::scheme_of (reused by safe_href) so the field validator rejects the same whitespace tricks (java\tscript:) that render-time href sanitization guards against.
Add a maxlength prop to the Input component and apply server-matching caps to Company Name (255, mirrors CreateCompanyRequest.name), Industry, Website, and the address text fields (255), Postal Code (12), and Country (2).
Surface server field errors: the typed API layer now carries the 422 envelope's per-field errors, and the company form maps a server "website" rejection onto the Website field instead of only showing the generic banner (MAPPS-210).
#MAPPS-213