mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 06:17:23 +01:00
Inviting a collaborator required them to already have a Loki account. The members route answered "No Loki account uses that email. Ask them to register first." — a dead end with no way to ask. The only other invite path creates a LOCAL-PASSWORD account and adds it to the inviter's whole org: broader than one project, and a second identity path beside OrangeCat, which fleet STACK.md says our own products must not grow. Now any email works: - Has an account: added at once, as before. - No account: a one-time invite is created, emailed when mail is configured, and ALWAYS returned as a link to copy — an email that was sent is not an email that was received. They open it, sign in with OrangeCat (creating that account on the way), and join exactly this project with exactly the role chosen. No Loki password anywhere. The link is bound to the invited email. A token is a bearer secret that gets forwarded; on its own it would let whoever holds the link in. The wrong account is told which address it was for, masked (ge•••@gmail.com) because the link may be in the wrong hands. Only a sha-256 of the token is stored, so a leaked backup cannot be replayed as working links. Acceptance spends the invite and grants the membership in one transaction guarded on accepted_at/revoked_at IS NULL, so a double click or two tabs grants once. Re-inviting the same email revokes the old link rather than leaving two live ones. "emailed" is only reported when mail is configured AND the send succeeded: sendEmail returns quietly when mail is off, so trusting the call alone would have claimed an email nobody sent. The panel moved from a collapsed "Editors" disclosure inside the Feedback tab to the top of the project's Settings tab — where every other product keeps "people with access", and where George looked for it. It now offers Editor or Viewer, lists pending invites, and lets the owner withdraw one. Editors do not see pending invitees' emails. The accept API lives under /api/invitations/project/ so it inherits the existing public-route exclusion instead of widening the proxy allow-list. Migration 0080 is hand-written, like 0073-0079: drizzle/meta's snapshot stops at 0072, so `drizzle-kit generate` diffs against a stale picture — it believes beacon_sessions still exists and calendar_busy does not, and would have emitted a DROP and a duplicate CREATE alongside this table. Tests: 14 checks on the acceptance rule, proved by mutation — removing the email binding turns the suite red. tsc clean, lint 0 errors, check:design ok, format ok, test:unit 260/260, test:home 130/130. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>