Skip to main content

invite_link

Function invite_link 

Source
pub async fn invite_link(
    db: &Db,
    mailer: &Mailer,
    base_url: &str,
    league: &League,
    invite_id: i64,
) -> Result<Option<InviteLink>, AppError>
Expand description

Mint a fresh link for an outstanding invite, attempt to email it once, and show it so the commissioner can also send it by hand — a text message, say.

The stored secret is hashed and cannot be read back, so “show me the link” necessarily means “mint a new one”: this retires whichever link went out before and restarts the invite’s expiry. Email delivery is best effort after the commit: a failure still returns the fresh link. None when the invite is already accepted, revoked, or belongs to another league.