feat: verified sign-up and several organizations per account #118

Merged
Sebi merged 1 commits from feat/verified-signup into main 2026-11-22 21:02:03 +00:00
Owner

Verified sign-up (#112)

  • Sign-up asks for name, email and password only. Where confirmation applies, the account starts unconfirmed and gets a link by mail (24 h, single use); the API answers verification_sent.
  • The link opens a page with a Confirm button — mail scanners that open links must not confirm or get a session. Confirming signs the account in.
  • Unconfirmed accounts get 403 email_unverified on sign-in — only with the correct password (wrong ones stay 401). Resend the confirmation email on the login page; the resend endpoint answers the same for unknown addresses. Unconfirmed accounts are purged by housekeeping after 7 days.
  • UPTIME_SIGNUP_VERIFY: auto (cloud: always; self-hosted: when UPTIME_SMTP_URL is set), required, off (rejected in the cloud edition). Confirmation required but no mail server → sign-up closed.
  • One account per mailbox: new users.email_key (lowercase, +suffix dropped, Gmail dots and googlemail.com folded), unique index; also set for invitation and SSO accounts (which count as confirmed: the organization invited that address / the IdP confirmed it). Existing accounts are backfilled and count as confirmed; if two existing accounts already share a key, only the older holds it.
  • Per client address: UPTIME_SIGNUPS_PER_IP accounts in 24 h (default 2; IPv6 grouped by /64), counted at creation — refused sign-ups do not count. 429 signup_limit.

Several organizations per account (#113)

  • Accounts without an organization are led to New organization (also after confirming); invited users are told to use their invitation link.
  • + next to the organization switcher → New organization; POST /api/v1/orgs creates one, makes it active, and enforces the per-account limit from #115 (422 org_limit), serialized per account.

Signup still accepts org_name/org_slug where no confirmation is needed (API compatibility, first-user setup). New pages: /signup/sent, /verify, /verify/resend, /orgs/new. Forms follow a redirect path from the server. Migration 00044. README and .env.example document the settings.

Tests: full flow with a test SMTP server (mail instead of session, sign-in refused before confirming, alias refused, resend, button page, single-use token, onboarding redirect, organization creation and limit, per-IP limit with refused sign-ups not counted, purge after a week); sign-up closed without mail when required; email key and IPv6 grouping units.

Closes #112
Closes #113

🤖 Generated with Claude Code

https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3

**Verified sign-up (#112)** - Sign-up asks for name, email and password only. Where confirmation applies, the account starts unconfirmed and gets a link by mail (24 h, single use); the API answers `verification_sent`. - The link opens a page with a **Confirm** button — mail scanners that open links must not confirm or get a session. Confirming signs the account in. - Unconfirmed accounts get `403 email_unverified` on sign-in — only with the correct password (wrong ones stay 401). *Resend the confirmation email* on the login page; the resend endpoint answers the same for unknown addresses. Unconfirmed accounts are purged by housekeeping after 7 days. - `UPTIME_SIGNUP_VERIFY`: `auto` (cloud: always; self-hosted: when `UPTIME_SMTP_URL` is set), `required`, `off` (rejected in the cloud edition). Confirmation required but no mail server → sign-up closed. - **One account per mailbox:** new `users.email_key` (lowercase, +suffix dropped, Gmail dots and googlemail.com folded), unique index; also set for invitation and SSO accounts (which count as confirmed: the organization invited that address / the IdP confirmed it). Existing accounts are backfilled and count as confirmed; if two existing accounts already share a key, only the older holds it. - **Per client address:** `UPTIME_SIGNUPS_PER_IP` accounts in 24 h (default 2; IPv6 grouped by /64), counted at creation — refused sign-ups do not count. `429 signup_limit`. **Several organizations per account (#113)** - Accounts without an organization are led to *New organization* (also after confirming); invited users are told to use their invitation link. - `+` next to the organization switcher → *New organization*; `POST /api/v1/orgs` creates one, makes it active, and enforces the per-account limit from #115 (`422 org_limit`), serialized per account. Signup still accepts `org_name`/`org_slug` where no confirmation is needed (API compatibility, first-user setup). New pages: `/signup/sent`, `/verify`, `/verify/resend`, `/orgs/new`. Forms follow a `redirect` path from the server. Migration `00044`. README and `.env.example` document the settings. **Tests:** full flow with a test SMTP server (mail instead of session, sign-in refused before confirming, alias refused, resend, button page, single-use token, onboarding redirect, organization creation and limit, per-IP limit with refused sign-ups not counted, purge after a week); sign-up closed without mail when required; email key and IPv6 grouping units. Closes #112 Closes #113 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi added this to the M12 Self-service signup & limits milestone 2026-11-22 20:59:25 +00:00
Sebi added 1 commit 2026-11-22 20:59:27 +00:00
feat: verified sign-up and several organizations per account
ci / image (pull_request) Successful in 3m59s
ci / build (pull_request) Successful in 5m46s
ci / test (pull_request) Successful in 12m32s
ci / lint (pull_request) Successful in 14m9s
87b2f2a256
New accounts confirm their email address before signing in: sign-up
mails a link valid for 24 hours, and its page confirms only when the
visitor presses the button, so mail scanners opening links do not sign
in. Confirming signs the account in; unconfirmed accounts are told so
only after giving the right password, can ask for a new link, and are
deleted after a week. UPTIME_SIGNUP_VERIFY requires confirmation always
in the cloud edition and self-hosted wherever mail can be sent; without
a mail server, sign-up that needs it stays closed.

One account per mailbox: users.email_key drops +suffixes, and dots for
Gmail, and is unique, including for accounts created through
invitations and SSO, which count as confirmed. A client address (IPv6:
its /64) may create UPTIME_SIGNUPS_PER_IP accounts a day, 2 by default;
refused sign-ups do not count.

Sign-up asks only for name, email and password. Accounts without an
organization are led to create one; signed-in users create further
organizations from the switcher, within the per-account limit, and
POST /api/v1/orgs does the same.

Closes #112
Closes #113

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi merged commit 1ad68e2e87 into main 2026-11-22 21:02:03 +00:00
Sebi deleted branch feat/verified-signup 2026-11-22 21:02:06 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ZB-Server/uptimesebi#118