Public: anyone can read this; the crew can change it.
The owner can close signup: one live setting, open or closed, kept on every way an account is made #1154
A forge admin can now close signup live, and /signup, POST /api/v1/users and edge first-sight accounts all obey it. The new test file and the capacity, guard-new-accounts, edge-auth, first-login and accounts tests pass, and tsc printed nothing. I did not run the whole suite.
stopped parked by the crew deploy 9ba37ed
I merged main into this branch, resolved the five conflicts, and pushed. The type check is clean. I did not run the whole test suite. I ran signup-closed, signup-passkey and capacity, and they pass.
The capacity test fails here only because this sandbox sets FORGE_CHECK_SHARDS=4, which isn't from the merge. With it cleared, capacity passes.
What changed
- Sign-up error:
signUpnow returnssignup_closedalongsidehuman_checkandpasskey_required. It checks the open/closed setting first, before the Turnstile check or any password hashing. - API sign-up:
POSTsign-up answers 403signup_closedwhen closed. It keeps the 422 answers forpasskey_requiredandhuman_check. - Sign-up page: a closed
/signupshows the closed page (403). The form handler also checks the setting, and shows the closed message if the error comes back anyway. - Capacity and admin API: the
signupsetting andsignupOpensit alongsidechildren.maxinsrc/core/capacity.ts.PATCH /api/v1/admin/settingssits alongside the new limits routes insrc/http/api.ts. - Boot check:
src/main.tskeeps theFORGE_SIGNUPword check and the new drain-linger check. - Test typing: I added a type cast in
test/signup-closed.test.tsso it type-checks.
Parked by the crew: the check stayed red through 2 automatic tries
A forge admin can now close signup live, and
/signup,POST /api/v1/usersand edge first-sight accounts all obey it. The new test file and the capacity, guard-new-accounts, edge-auth, first-login and accounts tests pass, andtscprinted nothing. I did not run the whole suite. The test run needed the sandbox switched off, because it blocked the unix socket the server listens on.What changed
signupis a new key in the existing capacity settings (src/core/capacity.ts), with valuesopen | invite | closedand a default ofopen.inviteis stored and acts likeclosed.capacityMCP tool, and the newPATCH /api/v1/admin/settings. The PATCH body is{"signup": "closed"}, needs an admin-scope token, and checks every key and value before applying any. The setting is read on every attempt, so no restart is needed.FORGE_SIGNUPsets it at boot. A wrong word makes the boot fail insrc/main.ts, likeFORGE_TRUSTED_PROXIES./signup(GET and POST) returns 403 with "Signup is closed on this forge."POST /api/v1/usersreturns 403signup_closedwith that sentence.ensureEdgeUsermakes no new account, though existing edge users still get in.capacity.changedevent and a row in the change history with who, when, and from what to what. I did not add a separate audit trail.test/signup-closed.test.tscovers each mode on the page, the API and the edge, the first-account exception, a live change by PATCH, refusal of wrong values and non-admins, and the audit row. The README mentionsFORGE_SIGNUP.Left out
invitehas no behaviour of its own, as the issue says.FORGE_SIGNUP=closedon a forge that already has users takes effect from boot, as intended.To try it: boot with
FORGE_SIGNUP=closed bun run src/main.ts, or sign in as admin and use Settings → Capacity → "Who can sign up".🤖 Generated with Claude Code
Closes #1142