Email verification (#31), ported onto main — supersedes #34 #39

Merged
Cordy merged 3 commits from feat/email-verify-v2 into main 2026-08-26 21:06:40 +00:00
Owner

Clean re-application of #34's email-verification backend onto current main, avoiding the stale-branch conflict and the stray committed binary that blocked #34. Supersedes #34 (close it once this merges).

Contents

  • verify.go / verify_test.go — copied verbatim from feat/email-verification (verify-token store, GET /v1/verify, POST /v1/verify/resend, sendVerification).
  • accounts.goaccount.Verified field; accountsAPI gains verifies + requireVerify; register/resend/verify routes wired; register returns 202 {status:"verify_sent"} (no session) when required, else 201 {token} as today; login returns 403 {reason:"unverified"} when required and unverified. The #33/#36 funnel recordEvent("register") is preserved (moved just above the new branch so account-creation is still recorded in both paths).
  • main.go — one-time grandfather backfill (marker-file guarded) marking pre-existing accounts verified, so enabling the gate never locks out a current customer.
  • .gitignore — ignore the /cairn-license-server build artifact (root cause of #34's stray binary).

Dormant by default

Everything is behind REQUIRE_EMAIL_VERIFICATION (default off): register still returns a token and login is ungated exactly as today until the flag is set.

Routing (confirmed)

  • Email link base = publicOrigin() → default https://license.swisscairn.ch (the /v1/verify endpoint). ✓
  • Post-verify redirect = siteURLhttps://www.swisscairn.ch/enter.html#verified (where the companion enter.html, already merged in cairn-site, handles it). ✓

go vet + full go test ./... (incl. TestEmailVerificationFlow) + amd64 build all green in the port workflow.

Clean re-application of #34's email-verification backend onto current `main`, avoiding the stale-branch conflict and the stray committed binary that blocked #34. **Supersedes #34** (close it once this merges). ## Contents - `verify.go` / `verify_test.go` — copied verbatim from `feat/email-verification` (verify-token store, `GET /v1/verify`, `POST /v1/verify/resend`, `sendVerification`). - `accounts.go` — `account.Verified` field; `accountsAPI` gains `verifies` + `requireVerify`; register/resend/verify routes wired; register returns `202 {status:"verify_sent"}` (no session) when required, else `201 {token}` as today; login returns `403 {reason:"unverified"}` when required and unverified. The #33/#36 funnel `recordEvent("register")` is preserved (moved just above the new branch so account-creation is still recorded in both paths). - `main.go` — one-time grandfather backfill (marker-file guarded) marking pre-existing accounts verified, so enabling the gate never locks out a current customer. - `.gitignore` — ignore the `/cairn-license-server` build artifact (root cause of #34's stray binary). ## Dormant by default Everything is behind `REQUIRE_EMAIL_VERIFICATION` (default off): register still returns a token and login is ungated exactly as today until the flag is set. ## Routing (confirmed) - Email link base = `publicOrigin()` → default `https://license.swisscairn.ch` (the `/v1/verify` endpoint). ✓ - Post-verify redirect = `siteURL` → `https://www.swisscairn.ch/enter.html#verified` (where the companion `enter.html`, already merged in cairn-site, handles it). ✓ `go vet` + full `go test ./...` (incl. `TestEmailVerificationFlow`) + amd64 build all green in the port workflow.
Cordy merged commit 48d47bb1b1 into main 2026-08-26 21:06:40 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/cairn-license-server#39
No description provided.