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,57 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
import { api, errorText } from "@/lib/api";
|
||||
|
||||
// A button, not an automatic request: link scanners of mail providers open
|
||||
// every link, and they must not unsubscribe anyone.
|
||||
export function Unsubscribe({ token }: { token: string | null }) {
|
||||
const [state, setState] = useState<"idle" | "busy" | "done">("idle");
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
if (!token) {
|
||||
return (
|
||||
<p className="msg msg-error" role="alert">
|
||||
Hiányzik a link vége. Nyisd meg a teljes linket a levélből.
|
||||
</p>
|
||||
);
|
||||
}
|
||||
if (state === "done") {
|
||||
return (
|
||||
<p className="msg msg-ok" role="status">
|
||||
Leiratkoztál: erre a címre nem küldünk több meghívót.
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
async function confirm() {
|
||||
setState("busy");
|
||||
setError(null);
|
||||
try {
|
||||
await api(`/public/invitations/unsubscribe?token=${encodeURIComponent(token!)}`, { method: "POST" });
|
||||
setState("done");
|
||||
} catch (e) {
|
||||
setError(errorText(e));
|
||||
setState("idle");
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="card field" style={{ gap: 12 }}>
|
||||
<p style={{ margin: 0 }}>
|
||||
Ha leiratkozol, erre az e-mail-címre többé nem küldünk meghívót, és a mostani meghívód is érvényét veszti.
|
||||
</p>
|
||||
<div>
|
||||
<button type="button" className="btn btn-primary" onClick={confirm} disabled={state === "busy"}>
|
||||
{state === "busy" ? "Leiratkozás…" : "Leiratkozom"}
|
||||
</button>
|
||||
</div>
|
||||
{error && (
|
||||
<p className="msg msg-error" role="alert">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user