Invitation-only sign-up, invitation e-mails and waitlist
- SIGNUP_MODE=invite (default): a new account needs an open invitation for its address, or the invitation link (then any Google account will do) - admin page "Meghívók": invite many addresses at once, personal message, resend (max 3, 24 h apart), revoke, copy link, mail preview and test copy, waitlist - invitation e-mail in HTML and plain text; Message-ID on the sender's domain, List-Unsubscribe with one-click POST, opt-out list (hashes only) - e-mail texts moved to a shared crate (crates/email-templates) - login page shows the invitation; waitlist for uninvited visitors; unsubscribe page; privacy policy updated - docs/levelkuldes.md: Brevo, DNS (SPF, DKIM, DMARC) and the SMTP setup Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
-- Invitations to the closed site. While SIGNUP_MODE=invite, a new account
|
||||
-- (Google or password) needs an open invitation for its address, or the
|
||||
-- invitation link itself (then any address will do).
|
||||
CREATE TABLE invitations (
|
||||
id uuid PRIMARY KEY,
|
||||
email text NOT NULL,
|
||||
message text CHECK (char_length(message) <= 300),
|
||||
locale text NOT NULL,
|
||||
invited_by uuid REFERENCES users (id) ON DELETE SET NULL,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
expires_at timestamptz NOT NULL,
|
||||
sent_count integer NOT NULL DEFAULT 1,
|
||||
last_sent_at timestamptz NOT NULL DEFAULT now(),
|
||||
accepted_at timestamptz,
|
||||
accepted_by uuid REFERENCES users (id) ON DELETE SET NULL,
|
||||
revoked_at timestamptz
|
||||
);
|
||||
-- At most one open invitation per address.
|
||||
CREATE UNIQUE INDEX invitations_open_email_idx ON invitations (email)
|
||||
WHERE accepted_at IS NULL AND revoked_at IS NULL;
|
||||
CREATE INDEX invitations_created_idx ON invitations (created_at DESC);
|
||||
|
||||
-- Link tokens (only their hashes). Every sending issues a new one, and the
|
||||
-- earlier links keep working while the invitation is open.
|
||||
CREATE TABLE invitation_tokens (
|
||||
token_hash bytea PRIMARY KEY,
|
||||
invitation_id uuid NOT NULL REFERENCES invitations (id) ON DELETE CASCADE,
|
||||
created_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
CREATE INDEX invitation_tokens_invitation_idx ON invitation_tokens (invitation_id);
|
||||
|
||||
-- Addresses that asked for no more invitations (only the SHA-256 of the address).
|
||||
CREATE TABLE email_optouts (
|
||||
email_hash bytea PRIMARY KEY,
|
||||
created_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
-- "Tell me when it opens": people without an invitation.
|
||||
CREATE TABLE waitlist (
|
||||
email text PRIMARY KEY,
|
||||
locale text NOT NULL,
|
||||
created_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
Reference in New Issue
Block a user