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:
@@ -2,6 +2,24 @@
|
||||
|
||||
use anyhow::{Context, bail};
|
||||
|
||||
/// Who may create an account.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum SignupMode {
|
||||
/// Anyone.
|
||||
Open,
|
||||
/// Only invited addresses (or the holder of an invitation link).
|
||||
Invite,
|
||||
}
|
||||
|
||||
impl SignupMode {
|
||||
pub fn as_str(self) -> &'static str {
|
||||
match self {
|
||||
SignupMode::Open => "open",
|
||||
SignupMode::Invite => "invite",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Config {
|
||||
/// `DATABASE_URL` (required).
|
||||
@@ -51,6 +69,9 @@ pub struct Config {
|
||||
pub free_person_slots: i64,
|
||||
/// `UNLIMITED_DAILY_LIMIT` (default 5): new detailed analyses a day with the unlimited package.
|
||||
pub unlimited_daily_limit: i64,
|
||||
/// `SIGNUP_MODE` (`invite` or `open`, default `invite`): whether new
|
||||
/// accounts need an invitation.
|
||||
pub signup_mode: SignupMode,
|
||||
}
|
||||
|
||||
fn var(name: &str) -> Option<String> {
|
||||
@@ -106,6 +127,11 @@ impl Config {
|
||||
max_charts_per_user: parsed("MAX_CHARTS_PER_USER", 1000)?,
|
||||
free_person_slots: parsed("FREE_PERSON_SLOTS", 0)?,
|
||||
unlimited_daily_limit: parsed("UNLIMITED_DAILY_LIMIT", 5)?,
|
||||
signup_mode: match var("SIGNUP_MODE").as_deref() {
|
||||
None | Some("invite") => SignupMode::Invite,
|
||||
Some("open") => SignupMode::Open,
|
||||
Some(other) => bail!("invalid SIGNUP_MODE '{other}': use 'invite' or 'open'"),
|
||||
},
|
||||
};
|
||||
if config.session_ttl_days < 1 {
|
||||
bail!("SESSION_TTL_DAYS must be at least 1");
|
||||
@@ -136,6 +162,7 @@ impl Config {
|
||||
max_charts_per_user: 50,
|
||||
free_person_slots: 5,
|
||||
unlimited_daily_limit: 3,
|
||||
signup_mode: SignupMode::Open,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user