diff options
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/auth-page.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/auth-page.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/auth-page.js b/packages/meshbay-hub/src/meshbay_hub/static/auth-page.js index d4dc5a4..04a00af 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/auth-page.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/auth-page.js @@ -10,6 +10,9 @@ import { Icon } from './icon.js'; const PASSWORD_MIN_BITS = 60; const PASSWORD_MIN_LEN = 12; +// The hub's USERNAME_MIN_LEN (api/users.py), checked here so the refusal comes +// before a passphrase derivation rather than after it. +const USERNAME_MIN_LEN = 8; // ── reCAPTCHA v2 helper ────────────────────────────────────────────────────── @@ -284,6 +287,9 @@ export function RegisterPage() { const onSubmit = async (e) => { e.preventDefault(); const name = username.trim(); + if (name.length < USERNAME_MIN_LEN) { + setError(t('register.err_username_len', { n: USERNAME_MIN_LEN })); return; + } if (password !== confirm) { setError(t('register.err_mismatch')); return; } if (password.length < PASSWORD_MIN_LEN) { setError(t('register.err_min_len', { n: PASSWORD_MIN_LEN })); return; |