Repository navigation
feat: invite-only registration (slice 28) - #29
Merged
Merged
Conversation
The register page now takes two people: whoever holds a valid invite link,
and the first person to reach an install that has no users yet. Everyone
else gets a 403 that says to ask their GM for a link, and the login page
stops offering to make an account. DEMGEM_REGISTRATION=open restores the
public page.
Support\Auth\RegistrationGate is the one place that decides. Fortify's
register view, CreateNewUser, and SignInWithDiscord's new-account step all
ask it. The gate looks the session's token up on every call, so an invite
revoked between the tap and the form closes the door with it.
An invite link is the front door for a guest now: /invites/{token} sits
outside the auth group, shows the campaign and the role, offers "Create an
account" and "Log in", and remembers the token and the intended URL so
register, login, and Discord all land back on the invite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
The register page is closed to strangers. It takes two people: whoever holds a valid invite link, and the first person to reach an install that has no users yet. Everyone else gets a 403 that says to ask their GM for a link, and the login page stops offering to make an account.
DEMGEM_REGISTRATION=openrestores the public page.How
Support\Auth\RegistrationGateis the one place that decides. It reads the mode, the session's invite token, and whether any user exists. Fortify's register view,CreateNewUser, andSignInWithDiscord's new-account step all ask it. Recorded in.ai/rules/auth.md./invites/{token}is the front door for a guest now. It sits outside the auth group, shows the campaign and the role, offers "Create an account" and "Log in", and remembers the token and the intended URL. Register, login, and Discord all land back on the invite. Accepting stays behind auth.Tests
tests/Feature/Auth/InviteOnlyRegistrationTest.php: closed page and POST with a user present, the first-user exception, the guest invite round trip through register and Join, a revoked invite and a bogus token, open mode, an unknown mode read as invite, the login link, and a logged-in visitor.DiscordLoginTest: refused while closed, linked user still signs in.AcceptInviteTestandRegistrationTest: the guest path and the open-page assumption updated.After merge
Set
DEMGEM_REGISTRATION=invitein the production env, or leave it unset, since invite is the default. Register the first account before that deploy, or right after: the empty install takes exactly one account on its own.Plan:
docs/plans/2026-09-13-feat-invite-only-registration-plan.md