Files
bvandeusenandClaude Opus 5.5 2b6e12859a
CI / lint (push) Successful in 3s
CI / integration (push) Failing after 1m17s
CI / unit (push) Successful in 1m43s
CI / publish (push) Skipped
feat(users): invite by email — a one-time link where the invitee makes their own account (milestone 496)
The operator's ask: an invite link sent by mail, the key in the URL, and
the new user choosing their own username, password and email.

- user_invites (migration 0037): the key's sha256 only, the address, the
  role and days the admin chose, who sent it, used/revoked.
- core/invites: create (revokes an older open invite to the address),
  renew (new key, new clock), find_pending, the four states, signup checks.
- /invite/<key>, outside sign-in and throttled like login: the invitee's
  username, email (prefilled, theirs to change) and password; the account
  takes the admin's role, the key is used up in the same transaction and
  they are signed in. A bad key gets one plain message.
- Settings › Users: Invite by email (address, role, 1/7/30 days), sent from
  the admin in their zone; without a mail server, or if sending fails, the
  link is shown once to copy. Invites not yet used are listed with Resend
  and Withdraw.
- Audit: user.invited, user.invite_resent, user.invite_revoked, user.joined.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 16:54:44 -04:00

25 lines
1.5 KiB
HTML

{# settings/user_invite_link.html — an invite's link, shown once (milestone
496), when mail didn't carry it: no mail server, or sending failed. #}
{% extends "base.html" %}
{% from "_macros.html" import crumbs, page_header %}
{% from "settings/_tabs.html" import settings_tabs %}
{% block title %}Invite link — Settings — Steward{% endblock %}
{% block section_tabs %}{{ settings_tabs("users") }}{% endblock %}
{% block breadcrumb %}{{ crumbs([("Settings", "/settings/"), ("Users", "/settings/users/"), ("Invite link", "")]) }}{% endblock %}
{% block content %}
{{ page_header("Invite link for " ~ invite.email) }}
<div class="form-page">
<p class="page-verdict" role="status">{{ why }}</p>
<section class="card form-section" aria-labelledby="link-title">
<h2 id="link-title" class="section-title">Copy this link now. It can't be shown again.</h2>
<div class="copy-once">
<input class="input" type="text" id="invite-url" value="{{ url }}" readonly aria-label="Invite link">
<button type="button" class="btn btn-ghost btn-sm"
onclick="navigator.clipboard.writeText(document.getElementById('invite-url').value).then(()=>this.textContent='Copied')">Copy</button>
</div>
<p class="field-hint">Send it to {{ invite.email }} yourself. It makes one {{ invite.role.value }} account and works until {{ invite.expires_at|when }}. If you lose it, resend the invite from Users for a new link.</p>
</section>
<div class="form-actions"><a href="/settings/users/" class="btn">Back to Users</a></div>
</div>
{% endblock %}