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
@@ -73,3 +73,22 @@ func TestPageSlice(t *testing.T) {
|
||||
t.Errorf("first %v, second %v, back %v", first, second, back)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmailKey(t *testing.T) {
|
||||
for in, want := range map[string]string{
|
||||
"Max.Power+uptime@googlemail.com": "maxpower@gmail.com",
|
||||
"max.power@gmail.com": "maxpower@gmail.com",
|
||||
"a.b+c@example.com": "a.b@example.com",
|
||||
"A.B@Example.com": "a.b@example.com",
|
||||
} {
|
||||
if got := emailKey(in); got != want {
|
||||
t.Errorf("emailKey(%q) = %q, want %q", in, got, want)
|
||||
}
|
||||
}
|
||||
if clientKey("2001:db8:1:2:aaaa::1") != clientKey("2001:db8:1:2:bbbb::9") || clientKey("2001:db8:1:3::1") == clientKey("2001:db8:1:2::1") {
|
||||
t.Error("IPv6 clients are not grouped by /64")
|
||||
}
|
||||
if clientKey("203.0.113.7") != "203.0.113.7" {
|
||||
t.Error("IPv4 clients are grouped")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user