Files
simple-aircraft-manager-rails/app/views/shared/_invitation_created.html.erb
T
rickyandClaude Opus 5.5 b4c7aaa3ff Invitation codes: a link that gives an account and roles
Ported from the original (InvitationCode), adapted to configurable roles.

- Admin → Invitations: a label, optionally one email address (only it can
  use the link, and it's emailed) and a name, how many uses (or
  unlimited), an expiry (or never), and a role on any aircraft (or none,
  for an account only).
- An aircraft's Access page: whoever manages its people invites to that
  aircraft, with only the roles they can give; they see and revoke its
  invitations.
- /join/<code>: shows what it gives; create an account (when password
  sign-in is on) or sign in, then accept. Existing accounts and SSO users
  accept too. A role someone already has on an aircraft stays.
- Roles are given as the invitation's creator (AircraftAccess), and only
  while they can still manage that aircraft's people. Codes are kept as
  digests and shown once; uses are counted under a lock; account creation
  and accepting are rate-limited; any invalid link gets the same answer.
- Docs: guide (Administration, Access & sharing), README, and why /join
  isn't on the Authentik bypass list. The README's not-yet-ported list
  now names Prometheus metrics, and no longer claims oil analysis import
  as new.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 18:50:58 -05:00

15 lines
1.2 KiB
ERB

<%# A just-made invitation's link: shown this once (only a digest is kept). %>
<section class="card card-body max-w-xl space-y-3">
<h1 class="card-title"><%= t("shared.invitation_created.title") %></h1>
<p class="text-sm text-slate-600"><%= t("shared.invitation_created.copy_now") %></p>
<input type="text" class="input font-mono text-xs" value="<%= join_url(invitation.token) %>" readonly data-select-on-click aria-label="<%= t("shared.invitation_created.link") %>">
<%= render "joins/grants", invitation: invitation %>
<p class="hint">
<%= [ (t("shared.invitation_created.emailed", email: invitation.email) if invitation.email && MailSettings.configured?),
(t("shared.invitation_created.only_for", email: invitation.email) if invitation.email),
(invitation.max_uses ? t("shared.invitation_created.uses", count: invitation.max_uses) : t("shared.invitation_created.unlimited")),
(invitation.expires_at ? t("shared.invitation_created.expires", time: l(invitation.expires_at, format: :app)) : t("shared.invitation_created.never_expires")) ].compact.join(" ") %>
</p>
<p><%= link_to t("shared.invitation_created.done"), back_path, class: "btn-primary" %></p>
</section>