feat: verified sign-up and several organizations per account
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
This commit is contained in:
1 parent
d644312f25
commit
87b2f2a256
29 files changed
+1698
-377
No files matched your search
+11
-2
@@ -22,9 +22,18 @@ func paged(o obj) obj {
|
||||
// show them.
|
||||
var endpoints = []endpoint{
|
||||
// Account
|
||||
{method: "POST", path: "/api/v1/auth/signup", tag: "Account", summary: "Create an account and organization", public: true,
|
||||
description: "Starts a session. Depending on the installation, sign-up is open, limited to the first user, or closed.",
|
||||
{method: "POST", path: "/api/v1/auth/signup", tag: "Account", summary: "Create an account", public: true,
|
||||
description: "Depending on the installation, sign-up is open, limited to the first user, or closed. Where addresses are confirmed, answers `{\"status\": \"verification_sent\"}` and mails a link; the account signs in after confirming. Otherwise starts a session, and `org_name`/`org_slug`, if given, create a first organization. One account per mailbox (+suffixes and Gmail dots count as the same address); a client address may create only a few accounts a day (`429 signup_limit`).",
|
||||
req: signupRequest{}, resp: sessionStarted},
|
||||
{method: "POST", path: "/api/v1/auth/verify", tag: "Account", summary: "Confirm an email address with the mailed token", public: true,
|
||||
description: "Signs the account in. Tokens are valid for 24 hours and once; `410 verification_expired` otherwise.",
|
||||
req: verifyRequest{}, resp: sessionStarted},
|
||||
{method: "POST", path: "/api/v1/auth/verify/resend", tag: "Account", summary: "Mail a new confirmation link", public: true,
|
||||
description: "Answers the same whether or not an unconfirmed account with that address exists.",
|
||||
req: resendRequest{}, status: http.StatusNoContent},
|
||||
{method: "POST", path: "/api/v1/orgs", tag: "Account", summary: "Create an organization", sessionOnly: true,
|
||||
description: "The account owns it, and it becomes the active organization. Limited per account by the platform (`422 org_limit`).",
|
||||
req: createOrgRequest{}, status: http.StatusCreated, resp: obj{"id": uuid.UUID{}, "slug": "", "redirect": ""}},
|
||||
{method: "POST", path: "/api/v1/auth/login", tag: "Account", summary: "Sign in with email and password", public: true,
|
||||
description: "Answers `{\"status\": \"totp_required\"}` when the account has two-factor authentication; continue with /auth/login/totp.",
|
||||
req: loginRequest{}, resp: sessionStarted},
|
||||
|
||||
Reference in new issue
Block a user