Player accounts: self-service player role, registration, and portal
#43
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature/player-accounts"
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?
Implements the full player-accounts plan — a public
playeraccount type living in the existinguserstable, reusing the current auth stack, plus a minimal React player portal.What's included
Data model (§1)
users.roleenum to includeplayer; makepassword_hashnullable (SSO-only players); addemail,email_verified,status(active/pending/disabled/banned),last_login_ip; pin the username_cicollation (case-insensitive uniqueness backstop). Idempotent migrations; seedsplayer_registration='disabled'.Registration (§2)
POST /auth/register— honeypot +registerLimiter+ botScore, reserved-name blocklist, duplicate→409, auto-login. Gated by theplayer_registrationsetting.finishLogin— the only, setting-gated relaxation of the link-only policy (default off = behaves exactly as today).Login / status (§3)
requireAuthand both login paths refuse non-activeaccounts (403), effective on the very next request.validatePasswordguards a null hash;last_login_iprecorded on login.Player self-service (§4)
/api/v1/player/*group gated byrequireRole('player'), reusingaccount.controller(TOTP, identities) plus new self-scopedchangeUsername/changePassword(accountChangeLimiter). Password change re-issues the caller's session so they aren't logged out, while revoking other sessions.SSO redirects (§5) — portal/
returnTo-aware: player flows land in/account*, staff in/admin*.Admin (§6) —
playerrole +status/emailon user create/update, role/status audit entries,player_registrationenum validation, derived publicregistrationflags. UI: role/status/reset-password inUserEditor, status column +badge-player, registration toggle in Settings.Player portal (§7) —
RequirePlayerguard,/account/{login,register}+ settings pages,api.register+api.player.*,AuthContext.register.Swagger (§8) —
Playertag + new schemas; regenerated served spec.Verification
usernamePolicy.test.js,playerAccounts.test.js; extendedssoCallback.test.js(auto-provision + portal redirect).tokens_valid_aftercutoff, SSO-only initial password, banned-login refusal./public/settingsexposes only derivedregistrationflags (never the raw key).Not yet done (needs a live/interactive environment)
/accountportal.🤖 Generated with Claude Code
https://claude.ai/code/session_019rao86n5cXpwAyjdBFEshV