refactor(web): one password rule and one wording for account-form errors (DRY W4)

The 8-character minimum was written into sign-up, reset, Settings › Account
and Admin › Users as minlength="8" and a message, and each page mapped
password_too_short, username_invalid and username_taken to its own copy of
the same sentence. lib/auth/password.ts now holds the minimum, the hint and
"Passwords do not match.", and the pages take an error code's wording from
the shared error copy (knownCopy), falling back to their own.

username_invalid's shared copy now states the rule (3–32 characters:
letters, numbers, underscores, hyphens), as the pages did, on web and
Android alike. Account's mismatch line reads "Passwords do not match." like
the other forms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-27 03:14:50 -05:00
co-authored by Claude Opus 5.5
parent 87c650aca1
commit d99498be0b
9 changed files with 50 additions and 44 deletions
@@ -79,7 +79,7 @@ object ErrorCopy {
"rate_limited" to "Too many attempts. Wait a few minutes and try again.",
"wrong_password" to "Current password is incorrect.",
"password_too_short" to "Password must be at least 8 characters.",
"username_invalid" to "That username isn't valid.",
"username_invalid" to "Username must be 3–32 characters: letters, numbers, underscores, hyphens.",
"username_taken" to "That username is already taken.",
"email_invalid" to "Enter a valid email address.",
"email_taken" to "That email is already in use.",