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
@@ -74,9 +74,16 @@ const (
|
||||
type API struct {
|
||||
Common
|
||||
Storage
|
||||
Listen string `env:"UPTIME_API_LISTEN" envDefault:":8080"`
|
||||
SecretKeys string `env:"UPTIME_SECRET_KEYS"`
|
||||
Signup SignupMode `env:"UPTIME_SIGNUP" envDefault:"first-user"`
|
||||
Listen string `env:"UPTIME_API_LISTEN" envDefault:":8080"`
|
||||
SecretKeys string `env:"UPTIME_SECRET_KEYS"`
|
||||
Signup SignupMode `env:"UPTIME_SIGNUP" envDefault:"first-user"`
|
||||
// SignupVerify is "auto", "required" or "off": whether new accounts
|
||||
// confirm their email address before signing in. Auto requires it in
|
||||
// the cloud edition and wherever mail can be sent.
|
||||
SignupVerify string `env:"UPTIME_SIGNUP_VERIFY" envDefault:"auto"`
|
||||
// SignupsPerIP limits sign-ups per client address (IPv6: per /64) in
|
||||
// 24 hours; 0 means unlimited.
|
||||
SignupsPerIP int `env:"UPTIME_SIGNUPS_PER_IP" envDefault:"2"`
|
||||
SessionIdle time.Duration `env:"UPTIME_SESSION_IDLE" envDefault:"168h"`
|
||||
SessionAbsolute time.Duration `env:"UPTIME_SESSION_ABSOLUTE" envDefault:"720h"`
|
||||
// PublicURL is the externally reachable base URL, used for SSO callbacks.
|
||||
@@ -137,6 +144,18 @@ func (a API) Validate() error {
|
||||
default:
|
||||
return fmt.Errorf("config: unknown UPTIME_SIGNUP %q", a.Signup)
|
||||
}
|
||||
switch a.SignupVerify {
|
||||
case "auto", "required":
|
||||
case "off":
|
||||
if a.Edition == EditionCloud {
|
||||
return fmt.Errorf("config: UPTIME_SIGNUP_VERIFY=off is not allowed in the cloud edition")
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("config: UPTIME_SIGNUP_VERIFY must be auto, required or off")
|
||||
}
|
||||
if a.SignupsPerIP < 0 {
|
||||
return fmt.Errorf("config: UPTIME_SIGNUPS_PER_IP must not be negative")
|
||||
}
|
||||
switch a.SSOPrivateNetworks {
|
||||
case "auto", "true", "false":
|
||||
default:
|
||||
|
||||
Reference in new issue
Block a user