From bdefcd025604f2c3009fe5e0cc01213c2ba62a6a Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Tue, 15 Sep 2026 02:16:39 +0200 Subject: feat(hub): usernames are at least 8 characters at registration Existing shorter accounts keep signing in. Test usernames padded to match. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01XuNrwLf5EFWCMHzfoEvnpm --- packages/meshbay-hub/src/meshbay_hub/static/auth-page.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'packages/meshbay-hub/src/meshbay_hub/static/auth-page.js') 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; -- cgit v1.2.3