Invitation flow for regular users with admin-configurable quota #332

Closed
opened 2026-08-05 12:09:31 +02:00 by fable-5 · 0 comments
Collaborator

Problem

On instances with closed registration, existing users cannot bring in collaborators; only a site admin can help (see companion issue on admin user creation). A lightweight, spam-resistant invitation flow is missing.

Proposal

Let any authenticated user invite people by email, guarded by a per-user quota that the site admin configures:

  • New invitations table: inviter, invitee email, token (stored hashed), status (pending / accepted / revoked), createdAt, expiresAt, acceptedUserId.
  • POST /api/v1/invitations sends a mail with an invitation link; GET /api/v1/invitations lists own invitations; DELETE /api/v1/invitations/:id revokes a pending one.
  • Accepting: the registration screen accepts an invitation token and allows account creation even when auth.registrationMode = closed (token is single-use, expires).
  • Quota against spam: new instance setting invitations.maxOpenPerUser, default 5 open (pending, unexpired) invitations per user; 0 disables inviting. Editable in the admin settings form (mind the react-hook-form dot-in-name trap, use the flat-key mapping from #322).
  • Audit actions (invitation.created, invitation.revoked, invitation.accepted) -> catalogue + docs + minor bump.
  • New settings key needs its hardening-guide line (M30) and the VS-NfD profile triage (#243).
  • UI: an Invitations section on the personal settings page (list, create, revoke, remaining quota); i18n de+en; accessible; e2e coverage.

Acceptance criteria

  • User can create an invitation while under quota; the 6th open invitation is rejected with a clear message (default quota).
  • Invitee can register through the link while registration is closed; token is single-use and expiring.
  • Revoked/expired tokens are rejected.
  • Admin can change the quota in the settings UI and the change takes effect (saved through the UI, per the #322 fence).
  • Audit events recorded and catalogued; settings key triaged for VS-NfD; hardening guide updated.
  • API e2e-db tests + web e2e test for the full invite -> register loop.
## Problem On instances with closed registration, existing users cannot bring in collaborators; only a site admin can help (see companion issue on admin user creation). A lightweight, spam-resistant invitation flow is missing. ## Proposal Let **any authenticated user invite people by email**, guarded by a per-user quota that the site admin configures: - New `invitations` table: inviter, invitee email, token (stored hashed), status (`pending` / `accepted` / `revoked`), `createdAt`, `expiresAt`, `acceptedUserId`. - `POST /api/v1/invitations` sends a mail with an invitation link; `GET /api/v1/invitations` lists own invitations; `DELETE /api/v1/invitations/:id` revokes a pending one. - Accepting: the registration screen accepts an invitation token and allows account creation **even when `auth.registrationMode = closed`** (token is single-use, expires). - **Quota against spam**: new instance setting `invitations.maxOpenPerUser`, default **5** open (pending, unexpired) invitations per user; `0` disables inviting. Editable in the admin settings form (mind the react-hook-form dot-in-name trap, use the flat-key mapping from #322). - Audit actions (`invitation.created`, `invitation.revoked`, `invitation.accepted`) -> catalogue + docs + minor bump. - New settings key needs its hardening-guide line (M30) and the VS-NfD profile triage (#243). - UI: an *Invitations* section on the personal settings page (list, create, revoke, remaining quota); i18n de+en; accessible; e2e coverage. ## Acceptance criteria - [ ] User can create an invitation while under quota; the 6th open invitation is rejected with a clear message (default quota). - [ ] Invitee can register through the link while registration is closed; token is single-use and expiring. - [ ] Revoked/expired tokens are rejected. - [ ] Admin can change the quota in the settings UI and the change takes effect (saved through the UI, per the #322 fence). - [ ] Audit events recorded and catalogued; settings key triaged for VS-NfD; hardening guide updated. - [ ] API e2e-db tests + web e2e test for the full invite -> register loop.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stwaidele/dorfteich#332
No description provided.