Files
FabledSteward/steward/templates/auth/invite.html
T
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

44 lines
2.3 KiB
HTML

{# auth/invite.html — where an invitee makes their own account (milestone 496).
`invite` is the working invite, or none: then only `error` shows. #}
{% extends "base.html" %}
{% block title %}Join Steward{% endblock %}
{% block content %}
<div class="invite-page">
<div class="card">
<h1 class="invite-title">Join Steward</h1>
{% if invite %}
<p class="invite-lede">{{ inviter }} invited you as {{ "an" if invite.role.value in ("admin", "operator") else "a" }} {{ invite.role.value }}. Choose your username, email and password.</p>
{% if session.user_id %}<p class="field-hint">You're signed in as {{ session.username }}. Making this account signs you in as it instead.</p>{% endif %}
{% endif %}
{% if error %}<div class="alert alert-error" role="alert">{{ error }}</div>{% endif %}
{% if invite %}
<form method="post" action="/invite/{{ key }}">{{ csrf_field() }}
<div class="field">
<label class="field-label" for="inv-username">Username</label>
<input class="input" id="inv-username" type="text" name="username" maxlength="64" required autofocus
autocomplete="username" value="{{ form.get('username', '') }}">
</div>
<div class="field">
<label class="field-label" for="inv-email">Email</label>
<input class="input" id="inv-email" type="email" name="email" maxlength="255" required
autocomplete="email" value="{{ form.get('email', '') }}">
<span class="field-hint">Steward sends alerts and the weekly report here; you can turn them off later.</span>
</div>
<div class="field">
<label class="field-label" for="inv-pw">Password</label>
<input class="input" id="inv-pw" type="password" name="password" minlength="{{ min_password }}" required autocomplete="new-password">
<span class="field-hint">At least {{ min_password }} characters.</span>
</div>
<div class="field">
<label class="field-label" for="inv-pw2">Password again</label>
<input class="input" id="inv-pw2" type="password" name="confirm" required autocomplete="new-password">
</div>
<button type="submit" class="btn invite-submit">Make my account</button>
</form>
{% else %}
<a href="/login" class="btn btn-ghost">Go to sign in</a>
{% endif %}
</div>
</div>
{% endblock %}