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

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:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 21:59:12 +01:00
1 parent d644312f25
commit 87b2f2a256
29 files changed
+1698 -377

No files matched your search

+34
View File
@@ -27,6 +27,10 @@ import (
func (s *Server) registerPages(r gin.IRouter) {
r.GET("/login", s.loginPage)
r.GET("/signup", s.signupPage)
r.GET("/signup/sent", s.signupSentPage)
r.GET("/verify", s.verifyPage)
r.GET("/verify/resend", s.resendPage)
r.GET("/orgs/new", s.newOrgPage)
r.GET("/invite/:token", s.invitePage)
s.registerConsole(r)
r.GET("/settings/security", s.securityPage)
@@ -105,6 +109,36 @@ func (s *Server) signupPage(c *gin.Context) {
web.Render(c, http.StatusOK, web.Signup(s.pageFor(c, "auth.signup.title")))
}
func (s *Server) signupSentPage(c *gin.Context) {
web.Render(c, http.StatusOK, web.SignupSent(s.pageFor(c, "auth.verify.sent_title")))
}
// verifyPage confirms an address only when the visitor presses the
// button: mail scanners that open links must not sign in.
func (s *Server) verifyPage(c *gin.Context) {
web.Render(c, http.StatusOK, web.Verify(s.pageFor(c, "auth.verify.title"), c.Query("token")))
}
func (s *Server) resendPage(c *gin.Context) {
web.Render(c, http.StatusOK, web.ResendVerification(s.pageFor(c, "auth.verify.resend_title")))
}
// newOrgPage lets a signed-in account create an organization: the first
// one after signing up, or another.
func (s *Server) newOrgPage(c *gin.Context) {
sess := auth.Current(c)
if sess == nil {
c.Redirect(http.StatusSeeOther, "/login?next=/orgs/new")
return
}
me, _, err := s.consoleMe(c, sess)
if err != nil {
internalError(c, err)
return
}
web.Render(c, http.StatusOK, web.NewOrgPage(s.pageFor(c, "orgs.new_title"), me))
}
// consoleMe loads the signed-in user and, if an organization is active,
// their permissions and policy state there. The principal is nil when the
// user has no active organization or is no longer a member.