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
@@ -13,6 +13,17 @@ UPTIME_PUBLIC_URL=http://localhost:8080
|
|||||||
# auto = allowed for UPTIME_EDITION=selfhosted, denied for cloud.
|
# auto = allowed for UPTIME_EDITION=selfhosted, denied for cloud.
|
||||||
UPTIME_SSO_ALLOW_PRIVATE_NETWORKS=auto
|
UPTIME_SSO_ALLOW_PRIVATE_NETWORKS=auto
|
||||||
|
|
||||||
|
# Who may sign up: first-user (only the operator of a fresh installation),
|
||||||
|
# open or closed. New accounts confirm their email address before signing in:
|
||||||
|
# auto = always in the cloud edition, self-hosted only when UPTIME_SMTP_URL is
|
||||||
|
# set; required; off (self-hosted only). Sign-ups per client address (IPv6:
|
||||||
|
# per /64) in 24 hours, 0 = unlimited.
|
||||||
|
# UPTIME_SIGNUP=first-user
|
||||||
|
# UPTIME_SIGNUP_VERIFY=auto
|
||||||
|
# UPTIME_SIGNUPS_PER_IP=2
|
||||||
|
# Outgoing mail, for email channels and sign-up confirmation.
|
||||||
|
# UPTIME_SMTP_URL=smtp://user:pass@mail.example.com:587?from=uptime@example.com
|
||||||
|
|
||||||
# Checker and status page reach the API only. Create tokens with:
|
# Checker and status page reach the API only. Create tokens with:
|
||||||
# api agent create --kind checker --region local --name dev
|
# api agent create --kind checker --region local --name dev
|
||||||
# api agent create --kind statuspage --name dev
|
# api agent create --kind statuspage --name dev
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ All settings are environment variables; [`.env.example`](.env.example) lists the
|
|||||||
|
|
||||||
- `UPTIME_SECRET_KEYS` encrypts stored secrets. Generate one with `echo "k1:$(head -c32 /dev/urandom | base64)"` and keep it safe; rotate by prepending a new key.
|
- `UPTIME_SECRET_KEYS` encrypts stored secrets. Generate one with `echo "k1:$(head -c32 /dev/urandom | base64)"` and keep it safe; rotate by prepending a new key.
|
||||||
- `UPTIME_PUBLIC_URL` is the address users reach the console at.
|
- `UPTIME_PUBLIC_URL` is the address users reach the console at.
|
||||||
|
- `UPTIME_SIGNUP` (`first-user`, `open`, `closed`) decides who may sign up. New accounts confirm their email address before signing in (`UPTIME_SIGNUP_VERIFY`: always in the cloud edition, self-hosted when `UPTIME_SMTP_URL` is set); one account per mailbox, and at most `UPTIME_SIGNUPS_PER_IP` (default 2) a day per client address.
|
||||||
- `UPTIME_TRUSTED_PROXIES` must name your reverse proxy, or client addresses in the audit log and rate limits will be the proxy's.
|
- `UPTIME_TRUSTED_PROXIES` must name your reverse proxy, or client addresses in the audit log and rate limits will be the proxy's.
|
||||||
- `UPTIME_RETENTION_*` set how long results, aggregates, audit entries and captured responses are kept.
|
- `UPTIME_RETENTION_*` set how long results, aggregates, audit entries and captured responses are kept.
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ func (r *receiver) kinds() []string {
|
|||||||
|
|
||||||
func TestAlerting(t *testing.T) {
|
func TestAlerting(t *testing.T) {
|
||||||
mail := notifytest.NewSMTP(t)
|
mail := notifytest.NewSMTP(t)
|
||||||
e := newEnvWith(t, func(c *config.API) { c.SMTPURL = mail.URL() })
|
e := newEnvWith(t, func(c *config.API) { c.SMTPURL, c.SignupVerify = mail.URL(), "off" })
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
t.Cleanup(cancel)
|
t.Cleanup(cancel)
|
||||||
go e.api.RunScheduler(ctx)
|
go e.api.RunScheduler(ctx)
|
||||||
|
|||||||
+11
-2
@@ -22,9 +22,18 @@ func paged(o obj) obj {
|
|||||||
// show them.
|
// show them.
|
||||||
var endpoints = []endpoint{
|
var endpoints = []endpoint{
|
||||||
// Account
|
// Account
|
||||||
{method: "POST", path: "/api/v1/auth/signup", tag: "Account", summary: "Create an account and organization", public: true,
|
{method: "POST", path: "/api/v1/auth/signup", tag: "Account", summary: "Create an account", public: true,
|
||||||
description: "Starts a session. Depending on the installation, sign-up is open, limited to the first user, or closed.",
|
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},
|
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,
|
{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.",
|
description: "Answers `{\"status\": \"totp_required\"}` when the account has two-factor authentication; continue with /auth/login/totp.",
|
||||||
req: loginRequest{}, resp: sessionStarted},
|
req: loginRequest{}, resp: sessionStarted},
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ var auditActions = map[string]string{
|
|||||||
"POST /api/v1/locale": "",
|
"POST /api/v1/locale": "",
|
||||||
"POST /api/v1/markdown/preview": "",
|
"POST /api/v1/markdown/preview": "",
|
||||||
"POST /api/v1/auth/signup": "account.signup",
|
"POST /api/v1/auth/signup": "account.signup",
|
||||||
|
"POST /api/v1/auth/verify": "account.verify",
|
||||||
|
"POST /api/v1/auth/verify/resend": "",
|
||||||
|
"POST /api/v1/orgs": "org.create",
|
||||||
"POST /api/v1/auth/login": "auth.login",
|
"POST /api/v1/auth/login": "auth.login",
|
||||||
"POST /api/v1/auth/login/totp": "auth.login",
|
"POST /api/v1/auth/login/totp": "auth.login",
|
||||||
"POST /api/v1/auth/logout": "auth.logout",
|
"POST /api/v1/auth/logout": "auth.logout",
|
||||||
|
|||||||
+52
-11
@@ -30,8 +30,11 @@ type signupRequest struct {
|
|||||||
Email string `json:"email" binding:"required,email,max=320"`
|
Email string `json:"email" binding:"required,email,max=320"`
|
||||||
Password string `json:"password" binding:"required,max=1024"`
|
Password string `json:"password" binding:"required,max=1024"`
|
||||||
DisplayName string `json:"display_name" binding:"max=200"`
|
DisplayName string `json:"display_name" binding:"max=200"`
|
||||||
OrgName string `json:"org_name" binding:"required,max=200"`
|
// OrgName and OrgSlug create a first organization at once, when no
|
||||||
OrgSlug string `json:"org_slug" binding:"required,max=63"`
|
// email confirmation is needed; otherwise the account creates one
|
||||||
|
// after confirming.
|
||||||
|
OrgName string `json:"org_name" binding:"max=200"`
|
||||||
|
OrgSlug string `json:"org_slug" binding:"max=63"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) signup(c *gin.Context) {
|
func (s *Server) signup(c *gin.Context) {
|
||||||
@@ -50,6 +53,15 @@ func (s *Server) signup(c *gin.Context) {
|
|||||||
fail(c, http.StatusForbidden, "signup_closed")
|
fail(c, http.StatusForbidden, "signup_closed")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if left, err := s.signupsLeft(c); err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
} else if !left {
|
||||||
|
fail(c, http.StatusTooManyRequests, "signup_limit")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
verify := s.verificationRequired()
|
||||||
|
withOrg := !verify && strings.TrimSpace(req.OrgName) != "" && strings.TrimSpace(req.OrgSlug) != ""
|
||||||
hash, err := auth.HashPassword(req.Password)
|
hash, err := auth.HashPassword(req.Password)
|
||||||
if errors.Is(err, auth.ErrPasswordTooShort) {
|
if errors.Is(err, auth.ErrPasswordTooShort) {
|
||||||
fail(c, http.StatusUnprocessableEntity, "password_too_short", "Min", auth.MinPasswordLength)
|
fail(c, http.StatusUnprocessableEntity, "password_too_short", "Min", auth.MinPasswordLength)
|
||||||
@@ -63,20 +75,27 @@ func (s *Server) signup(c *gin.Context) {
|
|||||||
var user store.User
|
var user store.User
|
||||||
err = s.db.Tx(ctx, tenant.Org(orgID, uuid.Nil), func(q *store.Queries) error {
|
err = s.db.Tx(ctx, tenant.Org(orgID, uuid.Nil), func(q *store.Queries) error {
|
||||||
var err error
|
var err error
|
||||||
user, err = q.CreateUser(ctx, store.CreateUserParams{
|
params := store.CreateUserParams{
|
||||||
Email: normalizeEmail(req.Email),
|
Email: normalizeEmail(req.Email),
|
||||||
DisplayName: strings.TrimSpace(req.DisplayName),
|
DisplayName: strings.TrimSpace(req.DisplayName),
|
||||||
PasswordHash: &hash,
|
PasswordHash: &hash,
|
||||||
Locale: ptr(i18n.Lang(ctx)),
|
Locale: ptr(i18n.Lang(ctx)),
|
||||||
})
|
EmailKey: ptr(emailKey(req.Email)),
|
||||||
|
}
|
||||||
|
if !verify {
|
||||||
|
params.EmailVerifiedAt = ptr(time.Now())
|
||||||
|
}
|
||||||
|
user, err = q.CreateUser(ctx, params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := q.CreateOrg(ctx, store.CreateOrgParams{ID: orgID, Slug: strings.ToLower(req.OrgSlug), Name: strings.TrimSpace(req.OrgName)}); err != nil {
|
if withOrg {
|
||||||
return err
|
if _, err := q.CreateOrg(ctx, store.CreateOrgParams{ID: orgID, Slug: strings.ToLower(req.OrgSlug), Name: strings.TrimSpace(req.OrgName)}); err != nil {
|
||||||
}
|
return err
|
||||||
if err := q.AddMembership(ctx, store.AddMembershipParams{OrgID: orgID, UserID: user.ID, IsOwner: true}); err != nil {
|
}
|
||||||
return err
|
if err := q.AddMembership(ctx, store.AddMembershipParams{OrgID: orgID, UserID: user.ID, IsOwner: true}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Whoever sets up a self-hosted installation operates it.
|
// Whoever sets up a self-hosted installation operates it.
|
||||||
if s.cfg.Signup == config.SignupFirstUser && s.cfg.Edition == config.EditionSelfHosted {
|
if s.cfg.Signup == config.SignupFirstUser && s.cfg.Edition == config.EditionSelfHosted {
|
||||||
@@ -85,7 +104,7 @@ func (s *Server) signup(c *gin.Context) {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
switch {
|
switch {
|
||||||
case isUniqueViolation(err, "users_email_key"):
|
case isUniqueViolation(err, "users_email_key"), isUniqueViolation(err, "users_email_key_idx"):
|
||||||
fail(c, http.StatusConflict, "email_taken")
|
fail(c, http.StatusConflict, "email_taken")
|
||||||
return
|
return
|
||||||
case isUniqueViolation(err, "orgs_slug_key"):
|
case isUniqueViolation(err, "orgs_slug_key"):
|
||||||
@@ -98,10 +117,27 @@ func (s *Server) signup(c *gin.Context) {
|
|||||||
internalError(c, err)
|
internalError(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
s.countSignup(c)
|
||||||
|
if verify {
|
||||||
|
auditActor(c, user.ID)
|
||||||
|
if err := s.sendVerification(ctx, user); err != nil {
|
||||||
|
s.log.ErrorContext(ctx, "sending verification failed", "error", err)
|
||||||
|
fail(c, http.StatusBadGateway, "verification_mail_failed")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.JSON(http.StatusOK, gin.H{"status": "verification_sent", "redirect": "/signup/sent"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !withOrg {
|
||||||
|
orgID = uuid.Nil
|
||||||
|
}
|
||||||
s.startSession(c, auth.NewSession{UserID: user.ID, OrgID: orgID, Locale: i18n.Lang(ctx), Method: auth.MethodPassword})
|
s.startSession(c, auth.NewSession{UserID: user.ID, OrgID: orgID, Locale: i18n.Lang(ctx), Method: auth.MethodPassword})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) signupAllowed(ctx context.Context) (bool, error) {
|
func (s *Server) signupAllowed(ctx context.Context) (bool, error) {
|
||||||
|
if s.signupClosedWithoutMail() {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
switch s.cfg.Signup {
|
switch s.cfg.Signup {
|
||||||
case config.SignupOpen:
|
case config.SignupOpen:
|
||||||
return true, nil
|
return true, nil
|
||||||
@@ -159,11 +195,16 @@ func (s *Server) login(c *gin.Context) {
|
|||||||
invalidCredentials(c)
|
invalidCredentials(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Only someone who knows the password learns of the suspension.
|
// Only someone who knows the password learns of the suspension or a
|
||||||
|
// missing confirmation.
|
||||||
if user.DisabledAt != nil {
|
if user.DisabledAt != nil {
|
||||||
fail(c, http.StatusForbidden, "account_suspended")
|
fail(c, http.StatusForbidden, "account_suspended")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if user.EmailVerifiedAt == nil {
|
||||||
|
fail(c, http.StatusForbidden, "email_unverified")
|
||||||
|
return
|
||||||
|
}
|
||||||
if rehash {
|
if rehash {
|
||||||
s.rehashPassword(ctx, user.ID, req.Password)
|
s.rehashPassword(ctx, user.ID, req.Password)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ func latestOf(b *browser, id string) (bool, string, bool) {
|
|||||||
func TestCheckerNetwork(t *testing.T) {
|
func TestCheckerNetwork(t *testing.T) {
|
||||||
// In the cloud edition, platform checkers stay off private networks
|
// In the cloud edition, platform checkers stay off private networks
|
||||||
// unless an admin allows it.
|
// unless an admin allows it.
|
||||||
cloud := newEnvWith(t, func(c *config.API) { c.Edition = config.EditionCloud })
|
cloud := newEnvWith(t, func(c *config.API) { c.Edition, c.SignupVerify = config.EditionCloud, "off" })
|
||||||
e := newEnv(t)
|
e := newEnv(t)
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
t.Cleanup(cancel)
|
t.Cleanup(cancel)
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ func (s *Server) dashboard(c *gin.Context) {
|
|||||||
internalError(c, err)
|
internalError(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if len(me.Orgs) == 0 {
|
||||||
|
// New accounts start by creating an organization.
|
||||||
|
c.Redirect(http.StatusSeeOther, "/orgs/new")
|
||||||
|
return
|
||||||
|
}
|
||||||
v := web.DashboardView{Counts: map[web.Status]int{}, Empty: true}
|
v := web.DashboardView{Counts: map[web.Status]int{}, Empty: true}
|
||||||
if p != nil && me.Policy == "" {
|
if p != nil && me.Policy == "" {
|
||||||
data, err := s.loadMonitorData(c.Request.Context(), p, web.RangeByKey(c.Query("range")))
|
data, err := s.loadMonitorData(c.Request.Context(), p, web.RangeByKey(c.Query("range")))
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ func (s *Server) RunHousekeeping(ctx context.Context) {
|
|||||||
// tokens and incidents older than the daily aggregate.
|
// tokens and incidents older than the daily aggregate.
|
||||||
func (s *Server) Housekeep(ctx context.Context, now time.Time) error {
|
func (s *Server) Housekeep(ctx context.Context, now time.Time) error {
|
||||||
keep := s.cfg.Retention
|
keep := s.cfg.Retention
|
||||||
var counts [6]int64
|
var counts [7]int64
|
||||||
err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
|
err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
|
||||||
var err error
|
var err error
|
||||||
if keep.Housekeeping > 0 {
|
if keep.Housekeeping > 0 {
|
||||||
@@ -75,15 +75,19 @@ func (s *Server) Housekeep(ctx context.Context, now time.Time) error {
|
|||||||
if _, err = q.PurgeAlertmanagerAlerts(ctx, now.Add(-keepAlerts)); err != nil {
|
if _, err = q.PurgeAlertmanagerAlerts(ctx, now.Add(-keepAlerts)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if counts[6], err = q.PurgeUnverifiedUsers(ctx, now.Add(-unverifiedKeep)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if keep.Daily > 0 {
|
if keep.Daily > 0 {
|
||||||
before := now.Add(-keep.Daily)
|
before := now.Add(-keep.Daily)
|
||||||
counts[3], err = q.PurgeIncidents(ctx, &before)
|
counts[3], err = q.PurgeIncidents(ctx, &before)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
if err == nil && counts != [6]int64{} {
|
if err == nil && counts != [7]int64{} {
|
||||||
s.log.InfoContext(ctx, "housekeeping purged rows",
|
s.log.InfoContext(ctx, "housekeeping purged rows",
|
||||||
"notifications", counts[0], "invitations", counts[1], "api_tokens", counts[2], "incidents", counts[3], "audit_events", counts[4], "evidence", counts[5])
|
"notifications", counts[0], "invitations", counts[1], "api_tokens", counts[2], "incidents", counts[3], "audit_events", counts[4], "evidence", counts[5],
|
||||||
|
"unverified_accounts", counts[6])
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,13 +279,16 @@ func (s *Server) inviteSignup(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
var user store.User
|
var user store.User
|
||||||
err = s.db.Tx(ctx, tenant.Global(), func(q *store.Queries) error {
|
err = s.db.Tx(ctx, tenant.Global(), func(q *store.Queries) error {
|
||||||
|
// The organization invited this address, which stands in for
|
||||||
|
// confirming it.
|
||||||
user, err = q.CreateUser(ctx, store.CreateUserParams{
|
user, err = q.CreateUser(ctx, store.CreateUserParams{
|
||||||
Email: inv.Email, DisplayName: strings.TrimSpace(req.DisplayName),
|
Email: inv.Email, DisplayName: strings.TrimSpace(req.DisplayName),
|
||||||
PasswordHash: &hash, Locale: ptr(i18n.Lang(ctx)),
|
PasswordHash: &hash, Locale: ptr(i18n.Lang(ctx)),
|
||||||
|
EmailKey: ptr(emailKey(inv.Email)), EmailVerifiedAt: ptr(time.Now()),
|
||||||
})
|
})
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
if isUniqueViolation(err, "users_email_key") {
|
if isUniqueViolation(err, "users_email_key") || isUniqueViolation(err, "users_email_key_idx") {
|
||||||
fail(c, http.StatusConflict, "email_taken")
|
fail(c, http.StatusConflict, "email_taken")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ import (
|
|||||||
func (s *Server) registerPages(r gin.IRouter) {
|
func (s *Server) registerPages(r gin.IRouter) {
|
||||||
r.GET("/login", s.loginPage)
|
r.GET("/login", s.loginPage)
|
||||||
r.GET("/signup", s.signupPage)
|
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)
|
r.GET("/invite/:token", s.invitePage)
|
||||||
s.registerConsole(r)
|
s.registerConsole(r)
|
||||||
r.GET("/settings/security", s.securityPage)
|
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")))
|
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,
|
// consoleMe loads the signed-in user and, if an organization is active,
|
||||||
// their permissions and policy state there. The principal is nil when the
|
// their permissions and policy state there. The principal is nil when the
|
||||||
// user has no active organization or is no longer a member.
|
// user has no active organization or is no longer a member.
|
||||||
|
|||||||
@@ -73,3 +73,22 @@ func TestPageSlice(t *testing.T) {
|
|||||||
t.Errorf("first %v, second %v, back %v", first, second, back)
|
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")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -108,6 +108,9 @@ func (s *Server) Mount(r gin.IRouter) {
|
|||||||
|
|
||||||
a := v1.Group("/auth")
|
a := v1.Group("/auth")
|
||||||
a.POST("/signup", s.signup)
|
a.POST("/signup", s.signup)
|
||||||
|
a.POST("/verify", s.verifyEmail)
|
||||||
|
a.POST("/verify/resend", s.resendVerification)
|
||||||
|
v1.POST("/orgs", auth.Require(), s.createOrg)
|
||||||
a.POST("/login", s.login)
|
a.POST("/login", s.login)
|
||||||
a.POST("/login/totp", s.loginTOTP)
|
a.POST("/login/totp", s.loginTOTP)
|
||||||
a.POST("/logout", s.logout)
|
a.POST("/logout", s.logout)
|
||||||
|
|||||||
@@ -0,0 +1,270 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"crypto/sha256"
|
||||||
|
"encoding/hex"
|
||||||
|
"errors"
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/jackc/pgx/v5"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
|
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/auth"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/notify"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/store"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/tenant"
|
||||||
|
)
|
||||||
|
|
||||||
|
// New accounts confirm their email address before signing in, through a
|
||||||
|
// link mailed to them. One mailbox holds one account, aliases included,
|
||||||
|
// and a client address may create only a few accounts a day.
|
||||||
|
|
||||||
|
const (
|
||||||
|
verifyTTL = 24 * time.Hour
|
||||||
|
// unverifiedKeep is how long an account waits for confirmation.
|
||||||
|
unverifiedKeep = 7 * 24 * time.Hour
|
||||||
|
)
|
||||||
|
|
||||||
|
// emailKey identifies the mailbox behind an address: +suffixes are dropped
|
||||||
|
// everywhere, and Gmail ignores dots and treats googlemail.com as gmail.com.
|
||||||
|
// The migration adding users.email_key computes the same.
|
||||||
|
func emailKey(email string) string {
|
||||||
|
local, domain, ok := strings.Cut(strings.ToLower(strings.TrimSpace(email)), "@")
|
||||||
|
if !ok {
|
||||||
|
return strings.ToLower(email)
|
||||||
|
}
|
||||||
|
local, _, _ = strings.Cut(local, "+")
|
||||||
|
if domain == "gmail.com" || domain == "googlemail.com" {
|
||||||
|
local, domain = strings.ReplaceAll(local, ".", ""), "gmail.com"
|
||||||
|
}
|
||||||
|
return local + "@" + domain
|
||||||
|
}
|
||||||
|
|
||||||
|
// clientKey groups client addresses for sign-up limits: IPv6 clients
|
||||||
|
// usually hold a whole /64.
|
||||||
|
func clientKey(ip string) string {
|
||||||
|
a := net.ParseIP(ip)
|
||||||
|
if a == nil || a.To4() != nil {
|
||||||
|
return ip
|
||||||
|
}
|
||||||
|
return a.Mask(net.CIDRMask(64, 128)).String() + "/64"
|
||||||
|
}
|
||||||
|
|
||||||
|
// verificationRequired reports whether new accounts confirm their email.
|
||||||
|
func (s *Server) verificationRequired() bool {
|
||||||
|
switch s.cfg.SignupVerify {
|
||||||
|
case "required":
|
||||||
|
return true
|
||||||
|
case "off":
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return s.cloud() || s.smtp != nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// signupsLeft reports whether the client may create another account.
|
||||||
|
func (s *Server) signupsLeft(c *gin.Context) (bool, error) {
|
||||||
|
if s.cfg.SignupsPerIP == 0 {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
n, err := s.rdb.Get(c.Request.Context(), "signups:"+clientKey(c.ClientIP())).Int()
|
||||||
|
if errors.Is(err, redis.Nil) {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
return n < s.cfg.SignupsPerIP, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// countSignup counts a created account against the client's daily limit.
|
||||||
|
func (s *Server) countSignup(c *gin.Context) {
|
||||||
|
if s.cfg.SignupsPerIP == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
key := "signups:" + clientKey(c.ClientIP())
|
||||||
|
pipe := s.rdb.TxPipeline()
|
||||||
|
pipe.Incr(ctx, key)
|
||||||
|
pipe.ExpireNX(ctx, key, 24*time.Hour)
|
||||||
|
if _, err := pipe.Exec(ctx); err != nil {
|
||||||
|
s.log.WarnContext(ctx, "counting sign-up failed", "error", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func verifyKey(token string) string {
|
||||||
|
sum := sha256.Sum256([]byte(token))
|
||||||
|
return "verify:" + hex.EncodeToString(sum[:])
|
||||||
|
}
|
||||||
|
|
||||||
|
// sendVerification mails u a link that confirms their address.
|
||||||
|
func (s *Server) sendVerification(ctx context.Context, u store.User) error {
|
||||||
|
if s.smtp == nil {
|
||||||
|
return errors.New("api: no mail server to send verification")
|
||||||
|
}
|
||||||
|
token := auth.RandomToken()
|
||||||
|
if err := s.rdb.Set(ctx, verifyKey(token), u.ID.String(), verifyTTL).Err(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
l := s.catalog.Match(deref(u.Locale))
|
||||||
|
link := strings.TrimSuffix(s.cfg.PublicURL, "/") + "/verify?token=" + url.QueryEscape(token)
|
||||||
|
data := map[string]any{"Link": link, "Hours": int(verifyTTL.Hours())}
|
||||||
|
return s.smtp.Send(ctx, notify.Mail{
|
||||||
|
To: []string{u.Email}, Subject: l.T("email.verify.subject", data), Body: l.T("email.verify.body", data),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
type verifyRequest struct {
|
||||||
|
Token string `json:"token" binding:"required,max=200"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// verifyEmail confirms the address the token was mailed to and signs the
|
||||||
|
// account in: whoever holds the link controls the mailbox.
|
||||||
|
func (s *Server) verifyEmail(c *gin.Context) {
|
||||||
|
var req verifyRequest
|
||||||
|
if !bind(c, &req) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
if !s.limit(c, "verify:ip:"+c.ClientIP(), 30, 15*time.Minute) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
raw, err := s.rdb.GetDel(ctx, verifyKey(req.Token)).Result()
|
||||||
|
id, perr := uuid.Parse(raw)
|
||||||
|
if errors.Is(err, redis.Nil) || perr != nil {
|
||||||
|
fail(c, http.StatusGone, "verification_expired")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var u store.User
|
||||||
|
err = s.db.Tx(ctx, tenant.Global(), func(q *store.Queries) error {
|
||||||
|
var err error
|
||||||
|
u, err = q.MarkEmailVerified(ctx, id)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if errors.Is(err, pgx.ErrNoRows) {
|
||||||
|
fail(c, http.StatusGone, "verification_expired")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
auditActor(c, u.ID)
|
||||||
|
if u.DisabledAt != nil {
|
||||||
|
fail(c, http.StatusForbidden, "account_suspended")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.finishLogin(c, u.ID, auth.MethodPassword)
|
||||||
|
}
|
||||||
|
|
||||||
|
type resendRequest struct {
|
||||||
|
Email string `json:"email" binding:"required,email,max=320"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// resendVerification mails a new link to an unconfirmed account. It
|
||||||
|
// answers the same whether or not such an account exists.
|
||||||
|
func (s *Server) resendVerification(c *gin.Context) {
|
||||||
|
var req resendRequest
|
||||||
|
if !bind(c, &req) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
email := normalizeEmail(req.Email)
|
||||||
|
if !s.limit(c, "resend:ip:"+c.ClientIP(), 10, time.Hour) || !s.limit(c, "resend:email:"+email, 3, time.Hour) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var u store.User
|
||||||
|
err := s.db.Tx(ctx, tenant.Global(), func(q *store.Queries) error {
|
||||||
|
var err error
|
||||||
|
u, err = q.GetUserByEmail(ctx, email)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
switch {
|
||||||
|
case errors.Is(err, pgx.ErrNoRows):
|
||||||
|
case err != nil:
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
case u.EmailVerifiedAt == nil && u.DisabledAt == nil:
|
||||||
|
if err := s.sendVerification(ctx, u); err != nil {
|
||||||
|
s.log.ErrorContext(ctx, "sending verification failed", "error", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
c.Status(http.StatusNoContent)
|
||||||
|
}
|
||||||
|
|
||||||
|
type createOrgRequest struct {
|
||||||
|
Name string `json:"name" binding:"required,max=200"`
|
||||||
|
Slug string `json:"slug" binding:"required,max=63"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// createOrg creates an organization owned by the signed-in account and
|
||||||
|
// makes it the active one.
|
||||||
|
func (s *Server) createOrg(c *gin.Context) {
|
||||||
|
var req createOrgRequest
|
||||||
|
if !bind(c, &req) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
sess := auth.Current(c)
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
u, err := s.loadUser(ctx, sess.UserID)
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
max := s.platformLimits(ctx).OrgsPerAccount
|
||||||
|
if u.LimitOrgs != nil {
|
||||||
|
max = int(*u.LimitOrgs)
|
||||||
|
}
|
||||||
|
orgID := uuid.New()
|
||||||
|
err = s.db.Tx(ctx, tenant.Org(orgID, sess.UserID), func(q *store.Queries) error {
|
||||||
|
if max > 0 {
|
||||||
|
// Serialize the account's creations to count them reliably.
|
||||||
|
if err := q.LockOrgUsage(ctx, u.ID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
n, err := q.CountOwnedOrgs(ctx, u.ID)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if n >= int64(max) {
|
||||||
|
return limitError{"org_limit", max}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if _, err := q.CreateOrg(ctx, store.CreateOrgParams{ID: orgID, Slug: strings.ToLower(strings.TrimSpace(req.Slug)), Name: strings.TrimSpace(req.Name)}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return q.AddMembership(ctx, store.AddMembershipParams{OrgID: orgID, UserID: u.ID, IsOwner: true})
|
||||||
|
})
|
||||||
|
switch {
|
||||||
|
case failLimit(c, err):
|
||||||
|
return
|
||||||
|
case isUniqueViolation(err, "orgs_slug_key"):
|
||||||
|
fail(c, http.StatusConflict, "slug_taken")
|
||||||
|
return
|
||||||
|
case isCheckViolation(err):
|
||||||
|
fail(c, http.StatusUnprocessableEntity, "invalid_slug")
|
||||||
|
return
|
||||||
|
case err != nil:
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
auditOrg(c, orgID)
|
||||||
|
if err := s.sessions.SwitchOrg(ctx, sess, orgID); err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.JSON(http.StatusCreated, gin.H{"id": orgID, "slug": strings.ToLower(strings.TrimSpace(req.Slug)), "redirect": "/"})
|
||||||
|
}
|
||||||
|
|
||||||
|
// signupClosedWithoutMail tells whether sign-up must wait for a mail
|
||||||
|
// server: accounts need confirming but no link could be sent.
|
||||||
|
func (s *Server) signupClosedWithoutMail() bool {
|
||||||
|
return s.verificationRequired() && s.smtp == nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
package api_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/jackc/pgx/v5"
|
||||||
|
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/config"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/notify/notifytest"
|
||||||
|
)
|
||||||
|
|
||||||
|
var verifyLink = regexp.MustCompile(`/verify\?token=([A-Za-z0-9_\-]+)`)
|
||||||
|
|
||||||
|
func TestVerifiedSignup(t *testing.T) {
|
||||||
|
mail := notifytest.NewSMTP(t)
|
||||||
|
e := newEnvWith(t, func(c *config.API) {
|
||||||
|
c.SMTPURL, c.SignupVerify, c.SignupsPerIP = mail.URL(), "auto", 2
|
||||||
|
})
|
||||||
|
// mailFor waits for the n-th mail and returns its confirmation token.
|
||||||
|
tokenOf := func(n int, to string) string {
|
||||||
|
t.Helper()
|
||||||
|
waitFor(t, 5*time.Second, "the confirmation mail", func() bool { return len(mail.Messages()) >= n })
|
||||||
|
msg := mail.Messages()[n-1]
|
||||||
|
if !strings.Contains(strings.Join(msg.To, ","), to) {
|
||||||
|
t.Fatalf("mail %d went to %v, want %s", n, msg.To, to)
|
||||||
|
}
|
||||||
|
m := verifyLink.FindStringSubmatch(msg.Data)
|
||||||
|
if m == nil {
|
||||||
|
t.Fatalf("mail lacks the link: %s", msg.Data)
|
||||||
|
}
|
||||||
|
return m[1]
|
||||||
|
}
|
||||||
|
box := uniq("max.power")
|
||||||
|
email := strings.ToUpper(box[:1]) + box[1:] + "+uptime@googlemail.com"
|
||||||
|
lower := strings.ToLower(email)
|
||||||
|
|
||||||
|
// Signing up mails a link instead of signing in.
|
||||||
|
b := e.browser(t)
|
||||||
|
st, body := b.do("POST", "/api/v1/auth/signup", map[string]any{"email": email, "password": testPassword, "display_name": "Max"})
|
||||||
|
if st != http.StatusOK || body["status"] != "verification_sent" {
|
||||||
|
t.Fatalf("signup = %d %v", st, body)
|
||||||
|
}
|
||||||
|
if st, _ := b.do("GET", "/api/v1/me", nil); st != http.StatusUnauthorized {
|
||||||
|
t.Errorf("signed in before confirming: %d", st)
|
||||||
|
}
|
||||||
|
token := tokenOf(1, lower)
|
||||||
|
|
||||||
|
// Unconfirmed accounts cannot sign in; only the right password says why.
|
||||||
|
st, body = e.browser(t).do("POST", "/api/v1/auth/login", map[string]any{"email": email, "password": testPassword})
|
||||||
|
expect(t, "sign-in before confirming", st, body, http.StatusForbidden, "email_unverified")
|
||||||
|
if st, _ := e.browser(t).do("POST", "/api/v1/auth/login", map[string]any{"email": email, "password": "wrong password"}); st != http.StatusUnauthorized {
|
||||||
|
t.Error("a wrong password reveals the missing confirmation")
|
||||||
|
}
|
||||||
|
|
||||||
|
// The same mailbox under another address is refused.
|
||||||
|
st, body = e.browser(t).do("POST", "/api/v1/auth/signup", map[string]any{"email": strings.ReplaceAll(box, ".", "") + "@gmail.com", "password": testPassword})
|
||||||
|
expect(t, "alias of an existing account", st, body, http.StatusConflict, "email_taken")
|
||||||
|
|
||||||
|
// Resending answers alike for unknown addresses and mails only real ones.
|
||||||
|
if st, _ := e.browser(t).do("POST", "/api/v1/auth/verify/resend", map[string]any{"email": "nobody@" + uniq("x") + ".test"}); st != http.StatusNoContent {
|
||||||
|
t.Errorf("resend for unknown = %d", st)
|
||||||
|
}
|
||||||
|
if st, _ := e.browser(t).do("POST", "/api/v1/auth/verify/resend", map[string]any{"email": email}); st != http.StatusNoContent {
|
||||||
|
t.Errorf("resend = %d", st)
|
||||||
|
}
|
||||||
|
tokenOf(2, lower)
|
||||||
|
if n := len(mail.Messages()); n != 2 {
|
||||||
|
t.Errorf("%d mails, want 2", n)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The link page asks before confirming; confirming signs in once.
|
||||||
|
if _, _, html := b.page("/verify?token=" + token); !strings.Contains(html, `name="token"`) {
|
||||||
|
t.Error("the link page lacks its form")
|
||||||
|
}
|
||||||
|
if st, body := b.do("POST", "/api/v1/auth/verify", map[string]any{"token": token}); st != http.StatusOK {
|
||||||
|
t.Fatalf("verify = %d %v", st, body)
|
||||||
|
}
|
||||||
|
st, body = e.browser(t).do("POST", "/api/v1/auth/verify", map[string]any{"token": token})
|
||||||
|
expect(t, "token used twice", st, body, http.StatusGone, "verification_expired")
|
||||||
|
|
||||||
|
// Without an organization, the console asks for one.
|
||||||
|
if got := b.visit("/"); got.Path != "/orgs/new" {
|
||||||
|
t.Errorf("dashboard leads to %s, want /orgs/new", got.Path)
|
||||||
|
}
|
||||||
|
slug := uniq("max-")
|
||||||
|
if st, body := b.do("POST", "/api/v1/orgs", map[string]any{"name": "Max Corp", "slug": slug}); st != http.StatusCreated {
|
||||||
|
t.Fatalf("create org = %d %v", st, body)
|
||||||
|
}
|
||||||
|
if got := b.visit("/"); got.Path != "/" {
|
||||||
|
t.Errorf("dashboard leads to %s after creating an organization", got.Path)
|
||||||
|
}
|
||||||
|
_, me := b.do("GET", "/api/v1/me", nil)
|
||||||
|
if !strings.Contains(mustJSON(me), slug) {
|
||||||
|
t.Errorf("me lacks the new organization: %v", me)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The account limit on organizations.
|
||||||
|
_ = e.asSystem(t, func(tx pgx.Tx) error {
|
||||||
|
_, err := tx.Exec(context.Background(), `UPDATE users SET limit_orgs = 1 WHERE email = $1`, lower)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
st, body = b.do("POST", "/api/v1/orgs", map[string]any{"name": "Second", "slug": uniq("max2-")})
|
||||||
|
expect(t, "second organization", st, body, http.StatusUnprocessableEntity, "org_limit")
|
||||||
|
|
||||||
|
// Two accounts per client address and day; refused sign-ups do not count.
|
||||||
|
if st, body := e.browser(t).do("POST", "/api/v1/auth/signup", map[string]any{"email": "two@" + uniq("x") + ".test", "password": testPassword}); st != http.StatusOK {
|
||||||
|
t.Fatalf("second account = %d %v", st, body)
|
||||||
|
}
|
||||||
|
st, body = e.browser(t).do("POST", "/api/v1/auth/signup", map[string]any{"email": "three@" + uniq("x") + ".test", "password": testPassword})
|
||||||
|
expect(t, "third account", st, body, http.StatusTooManyRequests, "signup_limit")
|
||||||
|
|
||||||
|
// Unconfirmed accounts go after a week.
|
||||||
|
_ = e.asSystem(t, func(tx pgx.Tx) error {
|
||||||
|
_, err := tx.Exec(context.Background(), `UPDATE users SET created_at = now() - interval '8 days' WHERE email_verified_at IS NULL AND email LIKE 'two@%'`)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if err := e.api.Housekeep(context.Background(), time.Now()); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
var left int
|
||||||
|
_ = e.asSystem(t, func(tx pgx.Tx) error {
|
||||||
|
return tx.QueryRow(context.Background(), `SELECT count(*) FROM users WHERE email LIKE 'two@%' AND created_at < now() - interval '7 days'`).Scan(&left)
|
||||||
|
})
|
||||||
|
if left != 0 {
|
||||||
|
t.Error("an unconfirmed account outlived its week")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSignupNeedsMail(t *testing.T) {
|
||||||
|
e := newEnvWith(t, func(c *config.API) { c.SignupVerify = "required" })
|
||||||
|
st, body := e.browser(t).do("POST", "/api/v1/auth/signup", map[string]any{"email": "a@" + uniq("x") + ".test", "password": testPassword})
|
||||||
|
expect(t, "sign-up without a mail server", st, body, http.StatusForbidden, "signup_closed")
|
||||||
|
}
|
||||||
@@ -319,10 +319,17 @@ func (s *Server) ssoResolveUser(ctx context.Context, row store.SsoProvider, cl s
|
|||||||
} else if !errors.Is(err, pgx.ErrNoRows) {
|
} else if !errors.Is(err, pgx.ErrNoRows) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// Another address of the same mailbox has an account.
|
||||||
|
if taken, err := q.EmailKeyTaken(ctx, ptr(emailKey(email))); err != nil || taken {
|
||||||
|
code = "sso_link_required"
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// The identity provider confirmed the address.
|
||||||
u, err := q.CreateUser(ctx, store.CreateUserParams{
|
u, err := q.CreateUser(ctx, store.CreateUserParams{
|
||||||
Email: email,
|
Email: email,
|
||||||
DisplayName: truncate(strings.TrimSpace(cl.Name), 200),
|
DisplayName: truncate(strings.TrimSpace(cl.Name), 200),
|
||||||
Locale: ptr(i18n.Lang(ctx)),
|
Locale: ptr(i18n.Lang(ctx)),
|
||||||
|
EmailKey: ptr(emailKey(email)), EmailVerifiedAt: ptr(time.Now()),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -74,9 +74,16 @@ const (
|
|||||||
type API struct {
|
type API struct {
|
||||||
Common
|
Common
|
||||||
Storage
|
Storage
|
||||||
Listen string `env:"UPTIME_API_LISTEN" envDefault:":8080"`
|
Listen string `env:"UPTIME_API_LISTEN" envDefault:":8080"`
|
||||||
SecretKeys string `env:"UPTIME_SECRET_KEYS"`
|
SecretKeys string `env:"UPTIME_SECRET_KEYS"`
|
||||||
Signup SignupMode `env:"UPTIME_SIGNUP" envDefault:"first-user"`
|
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"`
|
SessionIdle time.Duration `env:"UPTIME_SESSION_IDLE" envDefault:"168h"`
|
||||||
SessionAbsolute time.Duration `env:"UPTIME_SESSION_ABSOLUTE" envDefault:"720h"`
|
SessionAbsolute time.Duration `env:"UPTIME_SESSION_ABSOLUTE" envDefault:"720h"`
|
||||||
// PublicURL is the externally reachable base URL, used for SSO callbacks.
|
// PublicURL is the externally reachable base URL, used for SSO callbacks.
|
||||||
@@ -137,6 +144,18 @@ func (a API) Validate() error {
|
|||||||
default:
|
default:
|
||||||
return fmt.Errorf("config: unknown UPTIME_SIGNUP %q", a.Signup)
|
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 {
|
switch a.SSOPrivateNetworks {
|
||||||
case "auto", "true", "false":
|
case "auto", "true", "false":
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -56,6 +56,7 @@
|
|||||||
"audit.action.account.signup": "Konto erstellt",
|
"audit.action.account.signup": "Konto erstellt",
|
||||||
"audit.action.account.totp_disable": "Zwei-Faktor-Authentifizierung deaktiviert",
|
"audit.action.account.totp_disable": "Zwei-Faktor-Authentifizierung deaktiviert",
|
||||||
"audit.action.account.totp_enable": "Zwei-Faktor-Authentifizierung aktiviert",
|
"audit.action.account.totp_enable": "Zwei-Faktor-Authentifizierung aktiviert",
|
||||||
|
"audit.action.account.verify": "E-Mail-Adresse bestätigt",
|
||||||
"audit.action.agent.create": "Agent erstellt",
|
"audit.action.agent.create": "Agent erstellt",
|
||||||
"audit.action.agent.delete": "Agent widerrufen",
|
"audit.action.agent.delete": "Agent widerrufen",
|
||||||
"audit.action.agent.update": "Agent geändert",
|
"audit.action.agent.update": "Agent geändert",
|
||||||
@@ -88,6 +89,7 @@
|
|||||||
"audit.action.monitor.delete": "Monitor gelöscht",
|
"audit.action.monitor.delete": "Monitor gelöscht",
|
||||||
"audit.action.monitor.update": "Monitor geändert",
|
"audit.action.monitor.update": "Monitor geändert",
|
||||||
"audit.action.org.check_types_update": "Check-Typen geändert",
|
"audit.action.org.check_types_update": "Check-Typen geändert",
|
||||||
|
"audit.action.org.create": "Organisation angelegt",
|
||||||
"audit.action.org.delete": "Organisation gelöscht",
|
"audit.action.org.delete": "Organisation gelöscht",
|
||||||
"audit.action.org.export": "Daten der Organisation exportiert",
|
"audit.action.org.export": "Daten der Organisation exportiert",
|
||||||
"audit.action.org.legal_update": "Rechtstext geändert",
|
"audit.action.org.legal_update": "Rechtstext geändert",
|
||||||
@@ -153,6 +155,16 @@
|
|||||||
"auth.sso.heading": "Single Sign-on",
|
"auth.sso.heading": "Single Sign-on",
|
||||||
"auth.sso.org_placeholder": "Kurzname der Organisation",
|
"auth.sso.org_placeholder": "Kurzname der Organisation",
|
||||||
"auth.sso.submit": "Weiter",
|
"auth.sso.submit": "Weiter",
|
||||||
|
"auth.verify.intro": "Drücke den Knopf, um deine E-Mail-Adresse zu bestätigen und dich anzumelden.",
|
||||||
|
"auth.verify.resend_intro": "Wenn ein unbestätigtes Konto diese Adresse nutzt, schicken wir ihm einen neuen Link.",
|
||||||
|
"auth.verify.resend_link": "Bestätigungs-E-Mail erneut senden",
|
||||||
|
"auth.verify.resend_submit": "Link senden",
|
||||||
|
"auth.verify.resend_title": "Neuer Bestätigungslink",
|
||||||
|
"auth.verify.sent": "Wir haben dir einen Link geschickt, mit dem du deine E-Mail-Adresse bestätigst. Er ist 24 Stunden gültig.",
|
||||||
|
"auth.verify.sent_hint": "Nichts angekommen? Schau im Spam-Ordner nach oder fordere einen neuen Link an.",
|
||||||
|
"auth.verify.sent_title": "Schau in dein Postfach",
|
||||||
|
"auth.verify.submit": "Bestätigen und anmelden",
|
||||||
|
"auth.verify.title": "E-Mail-Adresse bestätigen",
|
||||||
"channels.create": "Kanal anlegen",
|
"channels.create": "Kanal anlegen",
|
||||||
"channels.created": "Webhook erstellt. Er ist bereits in der Standardgruppe. Kopiere den Signaturschlüssel, bevor du fortfährst.",
|
"channels.created": "Webhook erstellt. Er ist bereits in der Standardgruppe. Kopiere den Signaturschlüssel, bevor du fortfährst.",
|
||||||
"channels.delete_confirm": "Diesen Kanal löschen?",
|
"channels.delete_confirm": "Diesen Kanal löschen?",
|
||||||
@@ -466,6 +478,8 @@
|
|||||||
"email.resolved.subject": "[UP] {{.Monitor}}",
|
"email.resolved.subject": "[UP] {{.Monitor}}",
|
||||||
"email.test.body": "Dies ist ein Test. Wenn du ihn lesen kannst, funktioniert der Kanal.",
|
"email.test.body": "Dies ist ein Test. Wenn du ihn lesen kannst, funktioniert der Kanal.",
|
||||||
"email.test.subject": "Testbenachrichtigung von UptimeSebi",
|
"email.test.subject": "Testbenachrichtigung von UptimeSebi",
|
||||||
|
"email.verify.body": "Hallo,\n\nbitte bestätige deine E-Mail-Adresse, um die Registrierung abzuschließen:\n\n{{.Link}}\n\nDer Link ist {{.Hours}} Stunden gültig. Wenn du dich nicht registriert hast, ignoriere diese E-Mail; das Konto wird nach einer Woche gelöscht.",
|
||||||
|
"email.verify.subject": "Bestätige deine E-Mail-Adresse für UptimeSebi",
|
||||||
"error.account_suspended": "Dieser Account ist gesperrt. Wende dich an den Betreiber.",
|
"error.account_suspended": "Dieser Account ist gesperrt. Wende dich an den Betreiber.",
|
||||||
"error.agent_protocol_unsupported": "Diese Agent-Version wird von der API nicht unterstützt. Bitte den Agent aktualisieren.",
|
"error.agent_protocol_unsupported": "Diese Agent-Version wird von der API nicht unterstützt. Bitte den Agent aktualisieren.",
|
||||||
"error.alert_group_not_deletable": "Die Gruppe existiert nicht oder ist die geschützte Standardgruppe.",
|
"error.alert_group_not_deletable": "Die Gruppe existiert nicht oder ist die geschützte Standardgruppe.",
|
||||||
@@ -480,6 +494,7 @@
|
|||||||
"error.domain_taken": "Diese Domain nutzt bereits eine andere Statuspage.",
|
"error.domain_taken": "Diese Domain nutzt bereits eine andere Statuspage.",
|
||||||
"error.email_not_configured": "E-Mail ist auf diesem Server nicht verfügbar.",
|
"error.email_not_configured": "E-Mail ist auf diesem Server nicht verfügbar.",
|
||||||
"error.email_taken": "Diese E-Mail-Adresse ist bereits registriert.",
|
"error.email_taken": "Diese E-Mail-Adresse ist bereits registriert.",
|
||||||
|
"error.email_unverified": "Bestätige zuerst deine E-Mail-Adresse; wir haben dir einen Link geschickt. Einen neuen kannst du unten anfordern.",
|
||||||
"error.forbidden": "Dafür fehlt dir die Berechtigung.",
|
"error.forbidden": "Dafür fehlt dir die Berechtigung.",
|
||||||
"error.group_cycle": "Eine Gruppe kann nicht in sich selbst oder eine ihrer Untergruppen verschoben werden.",
|
"error.group_cycle": "Eine Gruppe kann nicht in sich selbst oder eine ihrer Untergruppen verschoben werden.",
|
||||||
"error.group_too_deep": "Gruppen lassen sich höchstens acht Ebenen tief verschachteln.",
|
"error.group_too_deep": "Gruppen lassen sich höchstens acht Ebenen tief verschachteln.",
|
||||||
@@ -537,6 +552,7 @@
|
|||||||
"error.no_domain": "Lege zuerst eine eigene Domain fest.",
|
"error.no_domain": "Lege zuerst eine eigene Domain fest.",
|
||||||
"error.no_password": "Konto ohne Passwort.",
|
"error.no_password": "Konto ohne Passwort.",
|
||||||
"error.not_found": "Nicht gefunden.",
|
"error.not_found": "Nicht gefunden.",
|
||||||
|
"error.org_limit": "Dein Konto darf höchstens {{.Max}} Organisationen besitzen.",
|
||||||
"error.org_not_found": "Organisation nicht gefunden.",
|
"error.org_not_found": "Organisation nicht gefunden.",
|
||||||
"error.org_suspended": "Der Betreiber hat diese Organisation gesperrt.",
|
"error.org_suspended": "Der Betreiber hat diese Organisation gesperrt.",
|
||||||
"error.owner_cannot_be_removed": "Der Owner kann nicht entfernt werden.",
|
"error.owner_cannot_be_removed": "Der Owner kann nicht entfernt werden.",
|
||||||
@@ -556,6 +572,7 @@
|
|||||||
"error.role_not_found": "Rolle nicht gefunden.",
|
"error.role_not_found": "Rolle nicht gefunden.",
|
||||||
"error.session_required": "Diese Aktion ist für API-Tokens nicht verfügbar.",
|
"error.session_required": "Diese Aktion ist für API-Tokens nicht verfügbar.",
|
||||||
"error.signup_closed": "Registrierung ist deaktiviert.",
|
"error.signup_closed": "Registrierung ist deaktiviert.",
|
||||||
|
"error.signup_limit": "Aus deinem Netz wurden heute zu viele Konten angelegt. Versuche es morgen wieder.",
|
||||||
"error.slug_taken": "Dieser Kurzname ist bereits vergeben.",
|
"error.slug_taken": "Dieser Kurzname ist bereits vergeben.",
|
||||||
"error.sso_denied": "Die Anmeldung wurde beim Identity Provider abgebrochen.",
|
"error.sso_denied": "Die Anmeldung wurde beim Identity Provider abgebrochen.",
|
||||||
"error.sso_discovery_failed": "Der Identity Provider ist nicht erreichbar oder lieferte keine gültige Konfiguration.",
|
"error.sso_discovery_failed": "Der Identity Provider ist nicht erreichbar oder lieferte keine gültige Konfiguration.",
|
||||||
@@ -582,6 +599,8 @@
|
|||||||
"error.unauthenticated": "Anmeldung erforderlich.",
|
"error.unauthenticated": "Anmeldung erforderlich.",
|
||||||
"error.unsupported_locale": "Sprache wird nicht unterstützt.",
|
"error.unsupported_locale": "Sprache wird nicht unterstützt.",
|
||||||
"error.user_owns_shared_orgs": "Dem Account gehören Organisationen mit weiteren Mitgliedern. Lösche diese zuerst oder übertrage sie.",
|
"error.user_owns_shared_orgs": "Dem Account gehören Organisationen mit weiteren Mitgliedern. Lösche diese zuerst oder übertrage sie.",
|
||||||
|
"error.verification_expired": "Dieser Bestätigungslink ist ungültig oder abgelaufen. Fordere einen neuen an.",
|
||||||
|
"error.verification_mail_failed": "Dein Konto wurde angelegt, aber die Bestätigungs-E-Mail konnte nicht gesendet werden. Fordere später einen neuen Link an.",
|
||||||
"evidence.body": "Antwort-Body",
|
"evidence.body": "Antwort-Body",
|
||||||
"evidence.body_binary": "Binärer Inhalt, nicht gespeichert.",
|
"evidence.body_binary": "Binärer Inhalt, nicht gespeichert.",
|
||||||
"evidence.body_empty": "Leer.",
|
"evidence.body_empty": "Leer.",
|
||||||
@@ -1043,9 +1062,14 @@
|
|||||||
"org.token_max_days": "Maximale Gültigkeit von API-Tokens (Tage)",
|
"org.token_max_days": "Maximale Gültigkeit von API-Tokens (Tage)",
|
||||||
"org.token_max_days_hint": "Neue Tokens müssen innerhalb dieses Zeitraums ablaufen. Beim Speichern werden bestehende Tokens gekürzt, die länger gelten würden. Leer lassen für keine Begrenzung.",
|
"org.token_max_days_hint": "Neue Tokens müssen innerhalb dieses Zeitraums ablaufen. Beim Speichern werden bestehende Tokens gekürzt, die länger gelten würden. Leer lassen für keine Begrenzung.",
|
||||||
"org.token_max_days_none": "unbegrenzt",
|
"org.token_max_days_none": "unbegrenzt",
|
||||||
|
"orgs.create": "Organisation anlegen",
|
||||||
|
"orgs.first_intro": "Dein Konto ist eingerichtet. Lege eine Organisation für deine Monitore und Statusseiten an.",
|
||||||
"orgs.intro": "Alle Organisationen mit Inhaber, Nutzung und Limits. Ein leeres Limit folgt dem Standard.",
|
"orgs.intro": "Alle Organisationen mit Inhaber, Nutzung und Limits. Ein leeres Limit folgt dem Standard.",
|
||||||
|
"orgs.invited_hint": "Wurdest du in eine Organisation eingeladen? Öffne stattdessen den Link aus der Einladung.",
|
||||||
"orgs.limits": "Limits dieser Organisation",
|
"orgs.limits": "Limits dieser Organisation",
|
||||||
"orgs.manage": "Limits, sperren oder löschen …",
|
"orgs.manage": "Limits, sperren oder löschen …",
|
||||||
|
"orgs.new_intro": "Du bist Inhaber und kannst andere einladen.",
|
||||||
|
"orgs.new_title": "Neue Organisation",
|
||||||
"orgs.none": "Keine Organisation gefunden.",
|
"orgs.none": "Keine Organisation gefunden.",
|
||||||
"orgs.owner_orgs": "Organisationen, die der Inhaber besitzen darf (besitzt {{.Count}})",
|
"orgs.owner_orgs": "Organisationen, die der Inhaber besitzen darf (besitzt {{.Count}})",
|
||||||
"orgs.search": "Name, Kürzel oder E-Mail des Inhabers",
|
"orgs.search": "Name, Kürzel oder E-Mail des Inhabers",
|
||||||
|
|||||||
@@ -56,6 +56,7 @@
|
|||||||
"audit.action.account.signup": "Account created",
|
"audit.action.account.signup": "Account created",
|
||||||
"audit.action.account.totp_disable": "Two-factor authentication disabled",
|
"audit.action.account.totp_disable": "Two-factor authentication disabled",
|
||||||
"audit.action.account.totp_enable": "Two-factor authentication enabled",
|
"audit.action.account.totp_enable": "Two-factor authentication enabled",
|
||||||
|
"audit.action.account.verify": "Email address confirmed",
|
||||||
"audit.action.agent.create": "Agent created",
|
"audit.action.agent.create": "Agent created",
|
||||||
"audit.action.agent.delete": "Agent revoked",
|
"audit.action.agent.delete": "Agent revoked",
|
||||||
"audit.action.agent.update": "Agent changed",
|
"audit.action.agent.update": "Agent changed",
|
||||||
@@ -88,6 +89,7 @@
|
|||||||
"audit.action.monitor.delete": "Monitor deleted",
|
"audit.action.monitor.delete": "Monitor deleted",
|
||||||
"audit.action.monitor.update": "Monitor changed",
|
"audit.action.monitor.update": "Monitor changed",
|
||||||
"audit.action.org.check_types_update": "Check types changed",
|
"audit.action.org.check_types_update": "Check types changed",
|
||||||
|
"audit.action.org.create": "Organization created",
|
||||||
"audit.action.org.delete": "Organization deleted",
|
"audit.action.org.delete": "Organization deleted",
|
||||||
"audit.action.org.export": "Organization data exported",
|
"audit.action.org.export": "Organization data exported",
|
||||||
"audit.action.org.legal_update": "Legal document changed",
|
"audit.action.org.legal_update": "Legal document changed",
|
||||||
@@ -153,6 +155,16 @@
|
|||||||
"auth.sso.heading": "Single sign-on",
|
"auth.sso.heading": "Single sign-on",
|
||||||
"auth.sso.org_placeholder": "Organization short name",
|
"auth.sso.org_placeholder": "Organization short name",
|
||||||
"auth.sso.submit": "Continue",
|
"auth.sso.submit": "Continue",
|
||||||
|
"auth.verify.intro": "Press the button to confirm your email address and sign in.",
|
||||||
|
"auth.verify.resend_intro": "If an unconfirmed account uses this address, we send it a new link.",
|
||||||
|
"auth.verify.resend_link": "Resend the confirmation email",
|
||||||
|
"auth.verify.resend_submit": "Send link",
|
||||||
|
"auth.verify.resend_title": "New confirmation link",
|
||||||
|
"auth.verify.sent": "We sent you a link to confirm your email address. It is valid for 24 hours.",
|
||||||
|
"auth.verify.sent_hint": "Nothing arrived? Look in your spam folder, or ask for a new link.",
|
||||||
|
"auth.verify.sent_title": "Check your inbox",
|
||||||
|
"auth.verify.submit": "Confirm and sign in",
|
||||||
|
"auth.verify.title": "Confirm your email address",
|
||||||
"channels.create": "Create channel",
|
"channels.create": "Create channel",
|
||||||
"channels.created": "Webhook created. It is already in the default alert group. Copy the signing secret before continuing.",
|
"channels.created": "Webhook created. It is already in the default alert group. Copy the signing secret before continuing.",
|
||||||
"channels.delete_confirm": "Delete this channel?",
|
"channels.delete_confirm": "Delete this channel?",
|
||||||
@@ -466,6 +478,8 @@
|
|||||||
"email.resolved.subject": "[UP] {{.Monitor}}",
|
"email.resolved.subject": "[UP] {{.Monitor}}",
|
||||||
"email.test.body": "This is a test. If you can read it, the channel works.",
|
"email.test.body": "This is a test. If you can read it, the channel works.",
|
||||||
"email.test.subject": "Test notification from UptimeSebi",
|
"email.test.subject": "Test notification from UptimeSebi",
|
||||||
|
"email.verify.body": "Hello,\n\nplease confirm your email address to finish signing up:\n\n{{.Link}}\n\nThe link is valid for {{.Hours}} hours. If you did not sign up, ignore this email; the account is deleted after a week.",
|
||||||
|
"email.verify.subject": "Confirm your email address for UptimeSebi",
|
||||||
"error.account_suspended": "This account is suspended. Contact the operator.",
|
"error.account_suspended": "This account is suspended. Contact the operator.",
|
||||||
"error.agent_protocol_unsupported": "This agent version is not supported by the API. Please update the agent.",
|
"error.agent_protocol_unsupported": "This agent version is not supported by the API. Please update the agent.",
|
||||||
"error.alert_group_not_deletable": "The group does not exist or is the protected default group.",
|
"error.alert_group_not_deletable": "The group does not exist or is the protected default group.",
|
||||||
@@ -480,6 +494,7 @@
|
|||||||
"error.domain_taken": "This domain is already used by another status page.",
|
"error.domain_taken": "This domain is already used by another status page.",
|
||||||
"error.email_not_configured": "Email is not available on this server.",
|
"error.email_not_configured": "Email is not available on this server.",
|
||||||
"error.email_taken": "This email address is already registered.",
|
"error.email_taken": "This email address is already registered.",
|
||||||
|
"error.email_unverified": "Confirm your email address first; we mailed you a link. You can ask for a new one below.",
|
||||||
"error.forbidden": "You are not allowed to do this.",
|
"error.forbidden": "You are not allowed to do this.",
|
||||||
"error.group_cycle": "A group cannot be placed inside itself or one of its subgroups.",
|
"error.group_cycle": "A group cannot be placed inside itself or one of its subgroups.",
|
||||||
"error.group_too_deep": "Groups can be nested at most eight levels deep.",
|
"error.group_too_deep": "Groups can be nested at most eight levels deep.",
|
||||||
@@ -537,6 +552,7 @@
|
|||||||
"error.no_domain": "Set a custom domain first.",
|
"error.no_domain": "Set a custom domain first.",
|
||||||
"error.no_password": "This account has no password.",
|
"error.no_password": "This account has no password.",
|
||||||
"error.not_found": "Not found.",
|
"error.not_found": "Not found.",
|
||||||
|
"error.org_limit": "Your account may own at most {{.Max}} organizations.",
|
||||||
"error.org_not_found": "Organization not found.",
|
"error.org_not_found": "Organization not found.",
|
||||||
"error.org_suspended": "The operator suspended this organization.",
|
"error.org_suspended": "The operator suspended this organization.",
|
||||||
"error.owner_cannot_be_removed": "The owner cannot be removed.",
|
"error.owner_cannot_be_removed": "The owner cannot be removed.",
|
||||||
@@ -556,6 +572,7 @@
|
|||||||
"error.role_not_found": "Role not found.",
|
"error.role_not_found": "Role not found.",
|
||||||
"error.session_required": "This action is not available to API tokens.",
|
"error.session_required": "This action is not available to API tokens.",
|
||||||
"error.signup_closed": "Sign-up is disabled.",
|
"error.signup_closed": "Sign-up is disabled.",
|
||||||
|
"error.signup_limit": "Too many accounts were created from your network today. Try again tomorrow.",
|
||||||
"error.slug_taken": "This short name is already taken.",
|
"error.slug_taken": "This short name is already taken.",
|
||||||
"error.sso_denied": "Sign-in was cancelled at the identity provider.",
|
"error.sso_denied": "Sign-in was cancelled at the identity provider.",
|
||||||
"error.sso_discovery_failed": "The identity provider could not be reached or returned no valid configuration.",
|
"error.sso_discovery_failed": "The identity provider could not be reached or returned no valid configuration.",
|
||||||
@@ -582,6 +599,8 @@
|
|||||||
"error.unauthenticated": "Authentication required.",
|
"error.unauthenticated": "Authentication required.",
|
||||||
"error.unsupported_locale": "Unsupported language.",
|
"error.unsupported_locale": "Unsupported language.",
|
||||||
"error.user_owns_shared_orgs": "The account owns organizations with other members. Delete those or hand them over first.",
|
"error.user_owns_shared_orgs": "The account owns organizations with other members. Delete those or hand them over first.",
|
||||||
|
"error.verification_expired": "This confirmation link is invalid or expired. Ask for a new one.",
|
||||||
|
"error.verification_mail_failed": "Your account was created, but the confirmation email could not be sent. Ask for a new link in a while.",
|
||||||
"evidence.body": "Response body",
|
"evidence.body": "Response body",
|
||||||
"evidence.body_binary": "Binary content, not stored.",
|
"evidence.body_binary": "Binary content, not stored.",
|
||||||
"evidence.body_empty": "Empty.",
|
"evidence.body_empty": "Empty.",
|
||||||
@@ -1043,9 +1062,14 @@
|
|||||||
"org.token_max_days": "Maximum API token lifetime (days)",
|
"org.token_max_days": "Maximum API token lifetime (days)",
|
||||||
"org.token_max_days_hint": "New tokens must expire within this period. Saving shortens existing tokens that would outlive it. Leave empty for no limit.",
|
"org.token_max_days_hint": "New tokens must expire within this period. Saving shortens existing tokens that would outlive it. Leave empty for no limit.",
|
||||||
"org.token_max_days_none": "unlimited",
|
"org.token_max_days_none": "unlimited",
|
||||||
|
"orgs.create": "Create organization",
|
||||||
|
"orgs.first_intro": "Your account is ready. Create an organization for your monitors and status pages.",
|
||||||
"orgs.intro": "All organizations with their owner, usage and limits. Leave a limit empty to follow the default.",
|
"orgs.intro": "All organizations with their owner, usage and limits. Leave a limit empty to follow the default.",
|
||||||
|
"orgs.invited_hint": "Were you invited to an organization? Open the link from the invitation instead.",
|
||||||
"orgs.limits": "Limits of this organization",
|
"orgs.limits": "Limits of this organization",
|
||||||
"orgs.manage": "Limits, suspend or delete …",
|
"orgs.manage": "Limits, suspend or delete …",
|
||||||
|
"orgs.new_intro": "You will own it and can invite others.",
|
||||||
|
"orgs.new_title": "New organization",
|
||||||
"orgs.none": "No organization matches.",
|
"orgs.none": "No organization matches.",
|
||||||
"orgs.owner_orgs": "Organizations the owner may own (owns {{.Count}})",
|
"orgs.owner_orgs": "Organizations the owner may own (owns {{.Count}})",
|
||||||
"orgs.search": "Name, slug or owner email",
|
"orgs.search": "Name, slug or owner email",
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
-- +goose Up
|
||||||
|
-- Accounts confirm their email address before signing in; existing ones
|
||||||
|
-- count as confirmed.
|
||||||
|
ALTER TABLE users ADD COLUMN email_verified_at timestamptz;
|
||||||
|
UPDATE users SET email_verified_at = created_at;
|
||||||
|
|
||||||
|
-- One account per mailbox: email_key is the address with +suffixes and,
|
||||||
|
-- for Gmail, dots removed (see emailKey in the api package). Accounts that
|
||||||
|
-- already share a key keep theirs empty; only the oldest holds it.
|
||||||
|
ALTER TABLE users ADD COLUMN email_key text;
|
||||||
|
WITH parts AS (
|
||||||
|
SELECT id, created_at,
|
||||||
|
split_part(split_part(lower(email::text), '@', 1), '+', 1) AS local,
|
||||||
|
split_part(lower(email::text), '@', 2) AS domain
|
||||||
|
FROM users
|
||||||
|
), keyed AS (
|
||||||
|
SELECT id,
|
||||||
|
CASE WHEN domain IN ('gmail.com', 'googlemail.com') THEN replace(local, '.', '') || '@gmail.com'
|
||||||
|
ELSE local || '@' || domain END AS key,
|
||||||
|
row_number() OVER (PARTITION BY
|
||||||
|
CASE WHEN domain IN ('gmail.com', 'googlemail.com') THEN replace(local, '.', '') || '@gmail.com'
|
||||||
|
ELSE local || '@' || domain END
|
||||||
|
ORDER BY created_at) AS n
|
||||||
|
FROM parts
|
||||||
|
)
|
||||||
|
UPDATE users u SET email_key = keyed.key FROM keyed WHERE keyed.id = u.id AND keyed.n = 1;
|
||||||
|
CREATE UNIQUE INDEX users_email_key_idx ON users (email_key);
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
DROP INDEX users_email_key_idx;
|
||||||
|
ALTER TABLE users DROP COLUMN email_key;
|
||||||
|
ALTER TABLE users DROP COLUMN email_verified_at;
|
||||||
+15
-13
@@ -389,19 +389,21 @@ type StatusPageMonitor struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
ID uuid.UUID
|
ID uuid.UUID
|
||||||
Email string
|
Email string
|
||||||
DisplayName string
|
DisplayName string
|
||||||
PasswordHash *string
|
PasswordHash *string
|
||||||
DisabledAt *time.Time
|
DisabledAt *time.Time
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
UpdatedAt time.Time
|
UpdatedAt time.Time
|
||||||
TotpSecret []byte
|
TotpSecret []byte
|
||||||
TotpEnabledAt *time.Time
|
TotpEnabledAt *time.Time
|
||||||
Locale *string
|
Locale *string
|
||||||
IsAdmin bool
|
IsAdmin bool
|
||||||
DisabledReason string
|
DisabledReason string
|
||||||
LimitOrgs *int32
|
LimitOrgs *int32
|
||||||
|
EmailVerifiedAt *time.Time
|
||||||
|
EmailKey *string
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserIdentity struct {
|
type UserIdentity struct {
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ type Querier interface {
|
|||||||
ClearStatusPageGroups(ctx context.Context, pageID uuid.UUID) error
|
ClearStatusPageGroups(ctx context.Context, pageID uuid.UUID) error
|
||||||
ClearStatusPageMonitors(ctx context.Context, pageID uuid.UUID) error
|
ClearStatusPageMonitors(ctx context.Context, pageID uuid.UUID) error
|
||||||
CountMonitors(ctx context.Context, orgID uuid.UUID) (int64, error)
|
CountMonitors(ctx context.Context, orgID uuid.UUID) (int64, error)
|
||||||
|
CountOwnedOrgs(ctx context.Context, userID uuid.UUID) (int64, error)
|
||||||
CountRoleAssignments(ctx context.Context, roleID uuid.UUID) (int64, error)
|
CountRoleAssignments(ctx context.Context, roleID uuid.UUID) (int64, error)
|
||||||
CountStatusPages(ctx context.Context, orgID uuid.UUID) (int64, error)
|
CountStatusPages(ctx context.Context, orgID uuid.UUID) (int64, error)
|
||||||
CountUnusedRecoveryCodes(ctx context.Context, userID uuid.UUID) (int64, error)
|
CountUnusedRecoveryCodes(ctx context.Context, userID uuid.UUID) (int64, error)
|
||||||
@@ -99,6 +100,7 @@ type Querier interface {
|
|||||||
DeleteSuccessEvidence(ctx context.Context, arg DeleteSuccessEvidenceParams) error
|
DeleteSuccessEvidence(ctx context.Context, arg DeleteSuccessEvidenceParams) error
|
||||||
DeleteUser(ctx context.Context, id uuid.UUID) (int64, error)
|
DeleteUser(ctx context.Context, id uuid.UUID) (int64, error)
|
||||||
DisableTOTP(ctx context.Context, id uuid.UUID) error
|
DisableTOTP(ctx context.Context, id uuid.UUID) error
|
||||||
|
EmailKeyTaken(ctx context.Context, emailKey *string) (bool, error)
|
||||||
EnableTOTP(ctx context.Context, arg EnableTOTPParams) error
|
EnableTOTP(ctx context.Context, arg EnableTOTPParams) error
|
||||||
EnqueueNotification(ctx context.Context, arg EnqueueNotificationParams) error
|
EnqueueNotification(ctx context.Context, arg EnqueueNotificationParams) error
|
||||||
// An empty name names a new region after its key and keeps an existing name.
|
// An empty name names a new region after its key and keeps an existing name.
|
||||||
@@ -224,6 +226,7 @@ type Querier interface {
|
|||||||
MaintenanceForMonitors(ctx context.Context, ids []uuid.UUID) ([]MaintenanceForMonitorsRow, error)
|
MaintenanceForMonitors(ctx context.Context, ids []uuid.UUID) ([]MaintenanceForMonitorsRow, error)
|
||||||
MakeAdmin(ctx context.Context, id uuid.UUID) error
|
MakeAdmin(ctx context.Context, id uuid.UUID) error
|
||||||
MarkDomainVerified(ctx context.Context, id uuid.UUID) error
|
MarkDomainVerified(ctx context.Context, id uuid.UUID) error
|
||||||
|
MarkEmailVerified(ctx context.Context, id uuid.UUID) (User, error)
|
||||||
MarkInvitationAccepted(ctx context.Context, id uuid.UUID) (int64, error)
|
MarkInvitationAccepted(ctx context.Context, id uuid.UUID) (int64, error)
|
||||||
MarkNotificationFailed(ctx context.Context, arg MarkNotificationFailedParams) error
|
MarkNotificationFailed(ctx context.Context, arg MarkNotificationFailedParams) error
|
||||||
MarkNotificationSent(ctx context.Context, id uuid.UUID) error
|
MarkNotificationSent(ctx context.Context, id uuid.UUID) error
|
||||||
@@ -262,6 +265,8 @@ type Querier interface {
|
|||||||
// Delivered and given-up notifications; pending ones are still being worked.
|
// Delivered and given-up notifications; pending ones are still being worked.
|
||||||
PurgeNotifications(ctx context.Context, createdAt time.Time) (int64, error)
|
PurgeNotifications(ctx context.Context, createdAt time.Time) (int64, error)
|
||||||
PurgeOrgCheckData(ctx context.Context, org uuid.UUID) error
|
PurgeOrgCheckData(ctx context.Context, org uuid.UUID) error
|
||||||
|
// Accounts never confirmed; they belong to no organization.
|
||||||
|
PurgeUnverifiedUsers(ctx context.Context, createdAt time.Time) (int64, error)
|
||||||
// Raw results bucketed by width since a point in time, for short ranges.
|
// Raw results bucketed by width since a point in time, for short ranges.
|
||||||
RangeBuckets(ctx context.Context, arg RangeBucketsParams) ([]RangeBucketsRow, error)
|
RangeBuckets(ctx context.Context, arg RangeBucketsParams) ([]RangeBucketsRow, error)
|
||||||
// The daily aggregate rebucketed by width, for ranges of months.
|
// The daily aggregate rebucketed by width, for ranges of months.
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
-- name: CreateUser :one
|
-- name: CreateUser :one
|
||||||
INSERT INTO users (email, display_name, password_hash, locale) VALUES ($1, $2, $3, $4)
|
INSERT INTO users (email, display_name, password_hash, locale, email_key, email_verified_at)
|
||||||
|
VALUES ($1, $2, $3, $4, sqlc.arg(email_key), sqlc.narg(email_verified_at))
|
||||||
RETURNING *;
|
RETURNING *;
|
||||||
|
|
||||||
|
-- name: MarkEmailVerified :one
|
||||||
|
UPDATE users SET email_verified_at = coalesce(email_verified_at, now()) WHERE id = $1
|
||||||
|
RETURNING *;
|
||||||
|
|
||||||
|
-- name: PurgeUnverifiedUsers :execrows
|
||||||
|
-- Accounts never confirmed; they belong to no organization.
|
||||||
|
DELETE FROM users u
|
||||||
|
WHERE u.email_verified_at IS NULL AND u.created_at < $1
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM memberships m WHERE m.user_id = u.id);
|
||||||
|
|
||||||
|
-- name: CountOwnedOrgs :one
|
||||||
|
SELECT count(*) FROM memberships WHERE user_id = $1 AND is_owner;
|
||||||
|
|
||||||
-- name: GetUser :one
|
-- name: GetUser :one
|
||||||
SELECT * FROM users WHERE id = $1;
|
SELECT * FROM users WHERE id = $1;
|
||||||
|
|
||||||
@@ -31,3 +45,6 @@ UPDATE users SET is_admin = $2, updated_at = now() WHERE email = $1;
|
|||||||
|
|
||||||
-- name: MakeAdmin :exec
|
-- name: MakeAdmin :exec
|
||||||
UPDATE users SET is_admin = true, updated_at = now() WHERE id = $1;
|
UPDATE users SET is_admin = true, updated_at = now() WHERE id = $1;
|
||||||
|
|
||||||
|
-- name: EmailKeyTaken :one
|
||||||
|
SELECT EXISTS (SELECT 1 FROM users WHERE email_key = $1);
|
||||||
@@ -7,6 +7,7 @@ package store
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
@@ -22,16 +23,30 @@ func (q *Queries) AnyUserExists(ctx context.Context) (bool, error) {
|
|||||||
return exists, err
|
return exists, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const countOwnedOrgs = `-- name: CountOwnedOrgs :one
|
||||||
|
SELECT count(*) FROM memberships WHERE user_id = $1 AND is_owner
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) CountOwnedOrgs(ctx context.Context, userID uuid.UUID) (int64, error) {
|
||||||
|
row := q.db.QueryRow(ctx, countOwnedOrgs, userID)
|
||||||
|
var count int64
|
||||||
|
err := row.Scan(&count)
|
||||||
|
return count, err
|
||||||
|
}
|
||||||
|
|
||||||
const createUser = `-- name: CreateUser :one
|
const createUser = `-- name: CreateUser :one
|
||||||
INSERT INTO users (email, display_name, password_hash, locale) VALUES ($1, $2, $3, $4)
|
INSERT INTO users (email, display_name, password_hash, locale, email_key, email_verified_at)
|
||||||
RETURNING id, email, display_name, password_hash, disabled_at, created_at, updated_at, totp_secret, totp_enabled_at, locale, is_admin, disabled_reason, limit_orgs
|
VALUES ($1, $2, $3, $4, $5, $6)
|
||||||
|
RETURNING id, email, display_name, password_hash, disabled_at, created_at, updated_at, totp_secret, totp_enabled_at, locale, is_admin, disabled_reason, limit_orgs, email_verified_at, email_key
|
||||||
`
|
`
|
||||||
|
|
||||||
type CreateUserParams struct {
|
type CreateUserParams struct {
|
||||||
Email string
|
Email string
|
||||||
DisplayName string
|
DisplayName string
|
||||||
PasswordHash *string
|
PasswordHash *string
|
||||||
Locale *string
|
Locale *string
|
||||||
|
EmailKey *string
|
||||||
|
EmailVerifiedAt *time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error) {
|
func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error) {
|
||||||
@@ -40,6 +55,8 @@ func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, e
|
|||||||
arg.DisplayName,
|
arg.DisplayName,
|
||||||
arg.PasswordHash,
|
arg.PasswordHash,
|
||||||
arg.Locale,
|
arg.Locale,
|
||||||
|
arg.EmailKey,
|
||||||
|
arg.EmailVerifiedAt,
|
||||||
)
|
)
|
||||||
var i User
|
var i User
|
||||||
err := row.Scan(
|
err := row.Scan(
|
||||||
@@ -56,6 +73,8 @@ func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, e
|
|||||||
&i.IsAdmin,
|
&i.IsAdmin,
|
||||||
&i.DisabledReason,
|
&i.DisabledReason,
|
||||||
&i.LimitOrgs,
|
&i.LimitOrgs,
|
||||||
|
&i.EmailVerifiedAt,
|
||||||
|
&i.EmailKey,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
@@ -81,6 +100,17 @@ func (q *Queries) DisableTOTP(ctx context.Context, id uuid.UUID) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const emailKeyTaken = `-- name: EmailKeyTaken :one
|
||||||
|
SELECT EXISTS (SELECT 1 FROM users WHERE email_key = $1)
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) EmailKeyTaken(ctx context.Context, emailKey *string) (bool, error) {
|
||||||
|
row := q.db.QueryRow(ctx, emailKeyTaken, emailKey)
|
||||||
|
var exists bool
|
||||||
|
err := row.Scan(&exists)
|
||||||
|
return exists, err
|
||||||
|
}
|
||||||
|
|
||||||
const enableTOTP = `-- name: EnableTOTP :exec
|
const enableTOTP = `-- name: EnableTOTP :exec
|
||||||
UPDATE users SET totp_secret = $2, totp_enabled_at = now(), updated_at = now() WHERE id = $1
|
UPDATE users SET totp_secret = $2, totp_enabled_at = now(), updated_at = now() WHERE id = $1
|
||||||
`
|
`
|
||||||
@@ -96,7 +126,7 @@ func (q *Queries) EnableTOTP(ctx context.Context, arg EnableTOTPParams) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getUser = `-- name: GetUser :one
|
const getUser = `-- name: GetUser :one
|
||||||
SELECT id, email, display_name, password_hash, disabled_at, created_at, updated_at, totp_secret, totp_enabled_at, locale, is_admin, disabled_reason, limit_orgs FROM users WHERE id = $1
|
SELECT id, email, display_name, password_hash, disabled_at, created_at, updated_at, totp_secret, totp_enabled_at, locale, is_admin, disabled_reason, limit_orgs, email_verified_at, email_key FROM users WHERE id = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetUser(ctx context.Context, id uuid.UUID) (User, error) {
|
func (q *Queries) GetUser(ctx context.Context, id uuid.UUID) (User, error) {
|
||||||
@@ -116,12 +146,14 @@ func (q *Queries) GetUser(ctx context.Context, id uuid.UUID) (User, error) {
|
|||||||
&i.IsAdmin,
|
&i.IsAdmin,
|
||||||
&i.DisabledReason,
|
&i.DisabledReason,
|
||||||
&i.LimitOrgs,
|
&i.LimitOrgs,
|
||||||
|
&i.EmailVerifiedAt,
|
||||||
|
&i.EmailKey,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const getUserByEmail = `-- name: GetUserByEmail :one
|
const getUserByEmail = `-- name: GetUserByEmail :one
|
||||||
SELECT id, email, display_name, password_hash, disabled_at, created_at, updated_at, totp_secret, totp_enabled_at, locale, is_admin, disabled_reason, limit_orgs FROM users WHERE email = $1
|
SELECT id, email, display_name, password_hash, disabled_at, created_at, updated_at, totp_secret, totp_enabled_at, locale, is_admin, disabled_reason, limit_orgs, email_verified_at, email_key FROM users WHERE email = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error) {
|
func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error) {
|
||||||
@@ -141,6 +173,8 @@ func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error
|
|||||||
&i.IsAdmin,
|
&i.IsAdmin,
|
||||||
&i.DisabledReason,
|
&i.DisabledReason,
|
||||||
&i.LimitOrgs,
|
&i.LimitOrgs,
|
||||||
|
&i.EmailVerifiedAt,
|
||||||
|
&i.EmailKey,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
@@ -154,6 +188,49 @@ func (q *Queries) MakeAdmin(ctx context.Context, id uuid.UUID) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const markEmailVerified = `-- name: MarkEmailVerified :one
|
||||||
|
UPDATE users SET email_verified_at = coalesce(email_verified_at, now()) WHERE id = $1
|
||||||
|
RETURNING id, email, display_name, password_hash, disabled_at, created_at, updated_at, totp_secret, totp_enabled_at, locale, is_admin, disabled_reason, limit_orgs, email_verified_at, email_key
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) MarkEmailVerified(ctx context.Context, id uuid.UUID) (User, error) {
|
||||||
|
row := q.db.QueryRow(ctx, markEmailVerified, id)
|
||||||
|
var i User
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.Email,
|
||||||
|
&i.DisplayName,
|
||||||
|
&i.PasswordHash,
|
||||||
|
&i.DisabledAt,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
&i.TotpSecret,
|
||||||
|
&i.TotpEnabledAt,
|
||||||
|
&i.Locale,
|
||||||
|
&i.IsAdmin,
|
||||||
|
&i.DisabledReason,
|
||||||
|
&i.LimitOrgs,
|
||||||
|
&i.EmailVerifiedAt,
|
||||||
|
&i.EmailKey,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const purgeUnverifiedUsers = `-- name: PurgeUnverifiedUsers :execrows
|
||||||
|
DELETE FROM users u
|
||||||
|
WHERE u.email_verified_at IS NULL AND u.created_at < $1
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM memberships m WHERE m.user_id = u.id)
|
||||||
|
`
|
||||||
|
|
||||||
|
// Accounts never confirmed; they belong to no organization.
|
||||||
|
func (q *Queries) PurgeUnverifiedUsers(ctx context.Context, createdAt time.Time) (int64, error) {
|
||||||
|
result, err := q.db.Exec(ctx, purgeUnverifiedUsers, createdAt)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return result.RowsAffected(), nil
|
||||||
|
}
|
||||||
|
|
||||||
const setPasswordHash = `-- name: SetPasswordHash :exec
|
const setPasswordHash = `-- name: SetPasswordHash :exec
|
||||||
UPDATE users SET password_hash = $2, updated_at = now() WHERE id = $1
|
UPDATE users SET password_hash = $2, updated_at = now() WHERE id = $1
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -140,6 +140,9 @@
|
|||||||
}
|
}
|
||||||
let next = form.dataset.next || location.href;
|
let next = form.dataset.next || location.href;
|
||||||
if (form.dataset.nextFrom) next += res.data?.[form.dataset.nextFrom] ?? "";
|
if (form.dataset.nextFrom) next += res.data?.[form.dataset.nextFrom] ?? "";
|
||||||
|
// The server may name where to go, within this site.
|
||||||
|
const redirect = res.data?.redirect;
|
||||||
|
if (typeof redirect === "string" && redirect.startsWith("/") && !redirect.startsWith("//")) next = redirect;
|
||||||
location.assign(next);
|
location.assign(next);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showError(form, message(err));
|
showError(form, message(err));
|
||||||
|
|||||||
+68
-3
@@ -19,6 +19,7 @@ templ Login(p Page, signupAllowed bool, next string) {
|
|||||||
</div>
|
</div>
|
||||||
@submit(i18n.T(ctx, "auth.login.submit"))
|
@submit(i18n.T(ctx, "auth.login.submit"))
|
||||||
</form>
|
</form>
|
||||||
|
<p class="mt-4 text-xs text-muted"><a href="/verify/resend" class="underline underline-offset-2 hover:text-ink">{ i18n.T(ctx, "auth.verify.resend_link") }</a></p>
|
||||||
<form action="/sso" method="get" class="mt-10 border-t border-rule pt-6">
|
<form action="/sso" method="get" class="mt-10 border-t border-rule pt-6">
|
||||||
<p class="mb-3 text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "auth.sso.heading") }</p>
|
<p class="mb-3 text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "auth.sso.heading") }</p>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
@@ -49,11 +50,75 @@ templ Signup(p Page) {
|
|||||||
@field(i18n.T(ctx, "auth.field.name"), "display_name", "text", "name", false)
|
@field(i18n.T(ctx, "auth.field.name"), "display_name", "text", "name", false)
|
||||||
@field(i18n.T(ctx, "auth.field.email"), "email", "email", "username", true)
|
@field(i18n.T(ctx, "auth.field.email"), "email", "email", "username", true)
|
||||||
@field(i18n.T(ctx, "auth.field.new_password", "Min", auth.MinPasswordLength), "password", "password", "new-password", true)
|
@field(i18n.T(ctx, "auth.field.new_password", "Min", auth.MinPasswordLength), "password", "password", "new-password", true)
|
||||||
<hr class="my-6 border-rule"/>
|
|
||||||
@field(i18n.T(ctx, "auth.field.org_name"), "org_name", "text", "organization", true)
|
|
||||||
@field(i18n.T(ctx, "auth.field.org_slug"), "org_slug", "text", "off", true)
|
|
||||||
@submit(i18n.T(ctx, "auth.signup.submit"))
|
@submit(i18n.T(ctx, "auth.signup.submit"))
|
||||||
</form>
|
</form>
|
||||||
<p class="mt-8 text-sm text-muted"><a class="text-ink underline underline-offset-2" href="/login">{ i18n.T(ctx, "auth.signup.to_login") }</a></p>
|
<p class="mt-8 text-sm text-muted"><a class="text-ink underline underline-offset-2" href="/login">{ i18n.T(ctx, "auth.signup.to_login") }</a></p>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
templ SignupSent(p Page) {
|
||||||
|
@authShell(p) {
|
||||||
|
<p class="text-sm">{ i18n.T(ctx, "auth.verify.sent") }</p>
|
||||||
|
<p class="mt-4 text-sm text-muted">{ i18n.T(ctx, "auth.verify.sent_hint") }</p>
|
||||||
|
<p class="mt-8 text-sm"><a href="/verify/resend" class="underline underline-offset-2">{ i18n.T(ctx, "auth.verify.resend_link") }</a></p>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify confirms an address when the visitor presses the button.
|
||||||
|
templ Verify(p Page, token string) {
|
||||||
|
@authShell(p) {
|
||||||
|
if token == "" {
|
||||||
|
<p class="text-sm">{ i18n.T(ctx, "error.verification_expired") }</p>
|
||||||
|
<p class="mt-6 text-sm"><a href="/verify/resend" class="underline underline-offset-2">{ i18n.T(ctx, "auth.verify.resend_link") }</a></p>
|
||||||
|
} else {
|
||||||
|
<form data-api="/auth/verify" data-next="/">
|
||||||
|
@formError()
|
||||||
|
<input type="hidden" name="token" value={ token }/>
|
||||||
|
<p class="mb-6 text-sm">{ i18n.T(ctx, "auth.verify.intro") }</p>
|
||||||
|
@submit(i18n.T(ctx, "auth.verify.submit"))
|
||||||
|
</form>
|
||||||
|
<p class="mt-6 text-xs text-muted"><a href="/verify/resend" class="underline underline-offset-2 hover:text-ink">{ i18n.T(ctx, "auth.verify.resend_link") }</a></p>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
templ ResendVerification(p Page) {
|
||||||
|
@authShell(p) {
|
||||||
|
<form data-api="/auth/verify/resend" data-next="/signup/sent">
|
||||||
|
@formError()
|
||||||
|
<p class="mb-4 text-sm text-muted">{ i18n.T(ctx, "auth.verify.resend_intro") }</p>
|
||||||
|
@field(i18n.T(ctx, "auth.field.email"), "email", "email", "username", true)
|
||||||
|
@submit(i18n.T(ctx, "auth.verify.resend_submit"))
|
||||||
|
</form>
|
||||||
|
<p class="mt-8 text-sm text-muted"><a class="text-ink underline underline-offset-2" href="/login">{ i18n.T(ctx, "auth.signup.to_login") }</a></p>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
templ newOrgForm() {
|
||||||
|
<form data-api="/orgs" data-next="/">
|
||||||
|
@formError()
|
||||||
|
@field(i18n.T(ctx, "auth.field.org_name"), "name", "text", "organization", true)
|
||||||
|
@field(i18n.T(ctx, "auth.field.org_slug"), "slug", "text", "off", true)
|
||||||
|
@submit(i18n.T(ctx, "orgs.create"))
|
||||||
|
</form>
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOrgPage creates an organization: the first, in a page of its own
|
||||||
|
// since there is no console yet, or another one.
|
||||||
|
templ NewOrgPage(p Page, me Me) {
|
||||||
|
if len(me.Orgs) == 0 {
|
||||||
|
@authShell(p) {
|
||||||
|
<p class="mb-6 text-sm text-muted">{ i18n.T(ctx, "orgs.first_intro") }</p>
|
||||||
|
@newOrgForm()
|
||||||
|
<p class="mt-8 text-sm text-muted">{ i18n.T(ctx, "orgs.invited_hint") }</p>
|
||||||
|
<button data-logout class="mt-4 text-sm underline underline-offset-2">{ i18n.T(ctx, "console.nav.logout") }</button>
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
@consoleShell(p, me) {
|
||||||
|
@settingsHeading("orgs.new_title", "orgs.new_intro")
|
||||||
|
<div class="max-w-sm">
|
||||||
|
@newOrgForm()
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+528
-50
@@ -105,90 +105,103 @@ func Login(p Page, signupAllowed bool, next string) templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</form><form action=\"/sso\" method=\"get\" class=\"mt-10 border-t border-rule pt-6\"><p class=\"mb-3 text-xs font-medium uppercase tracking-wider text-muted\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</form><p class=\"mt-4 text-xs text-muted\"><a href=\"/verify/resend\" class=\"underline underline-offset-2 hover:text-ink\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var5 string
|
var templ_7745c5c3_Var5 string
|
||||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.sso.heading"))
|
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.verify.resend_link"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 23, Col: 108}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 22, Col: 154}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</p><div class=\"flex gap-2\"><input class=\"min-w-0 flex-1 border border-rule bg-transparent px-2.5 py-1.5 font-mono text-sm outline-none focus:border-ink\" name=\"org\" placeholder=\"")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</a></p><form action=\"/sso\" method=\"get\" class=\"mt-10 border-t border-rule pt-6\"><p class=\"mb-3 text-xs font-medium uppercase tracking-wider text-muted\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var6 string
|
var templ_7745c5c3_Var6 string
|
||||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "auth.sso.org_placeholder")).Resolve(ctx)
|
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.sso.heading"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 28, Col: 58}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 24, Col: 108}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "\" aria-label=\"")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "</p><div class=\"flex gap-2\"><input class=\"min-w-0 flex-1 border border-rule bg-transparent px-2.5 py-1.5 font-mono text-sm outline-none focus:border-ink\" name=\"org\" placeholder=\"")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var7 string
|
var templ_7745c5c3_Var7 string
|
||||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "auth.sso.org_placeholder")).Resolve(ctx)
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "auth.sso.org_placeholder")).Resolve(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 29, Col: 57}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 29, Col: 58}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "\" autocomplete=\"organization\" required> <button type=\"submit\" class=\"border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "\" aria-label=\"")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var8 string
|
var templ_7745c5c3_Var8 string
|
||||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.sso.submit"))
|
templ_7745c5c3_Var8, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "auth.sso.org_placeholder")).Resolve(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 33, Col: 134}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 30, Col: 57}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "</button></div></form>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "\" autocomplete=\"organization\" required> <button type=\"submit\" class=\"border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var9 string
|
||||||
|
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.sso.submit"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 34, Col: 134}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "</button></div></form>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
if signupAllowed {
|
if signupAllowed {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "<p class=\"mt-8 text-sm text-muted\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "<p class=\"mt-8 text-sm text-muted\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var9 string
|
|
||||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.login.no_account"))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 38, Col: 42}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, " <a class=\"text-ink underline underline-offset-2\" href=\"/signup\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var10 string
|
var templ_7745c5c3_Var10 string
|
||||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.login.to_signup"))
|
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.login.no_account"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 39, Col: 105}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 39, Col: 42}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "</a></p>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, " <a class=\"text-ink underline underline-offset-2\" href=\"/signup\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var11 string
|
||||||
|
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.login.to_signup"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 40, Col: 105}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "</a></p>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -220,7 +233,7 @@ func Signup(p Page) templ.Component {
|
|||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
templ_7745c5c3_Var12 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
templ_7745c5c3_Var13 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||||
if !templ_7745c5c3_IsBuffer {
|
if !templ_7745c5c3_IsBuffer {
|
||||||
@@ -232,7 +245,7 @@ func Signup(p Page) templ.Component {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "<form data-api=\"/auth/signup\" data-next=\"/\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "<form data-api=\"/auth/signup\" data-next=\"/\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -252,18 +265,6 @@ func Signup(p Page) templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "<hr class=\"my-6 border-rule\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = field(i18n.T(ctx, "auth.field.org_name"), "org_name", "text", "organization", true).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = field(i18n.T(ctx, "auth.field.org_slug"), "org_slug", "text", "off", true).Render(ctx, templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = submit(i18n.T(ctx, "auth.signup.submit")).Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = submit(i18n.T(ctx, "auth.signup.submit")).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
@@ -272,12 +273,12 @@ func Signup(p Page) templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var13 string
|
var templ_7745c5c3_Var14 string
|
||||||
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.signup.to_login"))
|
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.signup.to_login"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 57, Col: 137}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 55, Col: 137}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -287,7 +288,7 @@ func Signup(p Page) templ.Component {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var12), templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var13), templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -295,4 +296,481 @@ func Signup(p Page) templ.Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SignupSent(p Page) templ.Component {
|
||||||
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
|
return templ_7745c5c3_CtxErr
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||||
|
if !templ_7745c5c3_IsBuffer {
|
||||||
|
defer func() {
|
||||||
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err == nil {
|
||||||
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
ctx = templ.InitializeContext(ctx)
|
||||||
|
ctx = templ.ClearChildren(ctx)
|
||||||
|
templ_7745c5c3_Var16 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||||
|
if !templ_7745c5c3_IsBuffer {
|
||||||
|
defer func() {
|
||||||
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err == nil {
|
||||||
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
ctx = templ.InitializeContext(ctx)
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "<p class=\"text-sm\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var17 string
|
||||||
|
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.verify.sent"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 61, Col: 54}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "</p><p class=\"mt-4 text-sm text-muted\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var18 string
|
||||||
|
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.verify.sent_hint"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 62, Col: 75}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "</p><p class=\"mt-8 text-sm\"><a href=\"/verify/resend\" class=\"underline underline-offset-2\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var19 string
|
||||||
|
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.verify.resend_link"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 63, Col: 128}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "</a></p>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var16), templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify confirms an address when the visitor presses the button.
|
||||||
|
func Verify(p Page, token string) templ.Component {
|
||||||
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
|
return templ_7745c5c3_CtxErr
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||||
|
if !templ_7745c5c3_IsBuffer {
|
||||||
|
defer func() {
|
||||||
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err == nil {
|
||||||
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
ctx = templ.InitializeContext(ctx)
|
||||||
|
ctx = templ.ClearChildren(ctx)
|
||||||
|
templ_7745c5c3_Var21 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||||
|
if !templ_7745c5c3_IsBuffer {
|
||||||
|
defer func() {
|
||||||
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err == nil {
|
||||||
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
ctx = templ.InitializeContext(ctx)
|
||||||
|
if token == "" {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "<p class=\"text-sm\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var22 string
|
||||||
|
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.verification_expired"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 71, Col: 65}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "</p><p class=\"mt-6 text-sm\"><a href=\"/verify/resend\" class=\"underline underline-offset-2\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var23 string
|
||||||
|
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.verify.resend_link"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 72, Col: 129}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "</a></p>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "<form data-api=\"/auth/verify\" data-next=\"/\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = formError().Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "<input type=\"hidden\" name=\"token\" value=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var24 string
|
||||||
|
templ_7745c5c3_Var24, templ_7745c5c3_Err = templruntime.NewAttributeExpression(token).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 76, Col: 51}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var24)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "\"><p class=\"mb-6 text-sm\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var25 string
|
||||||
|
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.verify.intro"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 77, Col: 62}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</p>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = submit(i18n.T(ctx, "auth.verify.submit")).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "</form><p class=\"mt-6 text-xs text-muted\"><a href=\"/verify/resend\" class=\"underline underline-offset-2 hover:text-ink\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var26 string
|
||||||
|
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.verify.resend_link"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 80, Col: 155}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "</a></p>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var21), templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func ResendVerification(p Page) templ.Component {
|
||||||
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
|
return templ_7745c5c3_CtxErr
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||||
|
if !templ_7745c5c3_IsBuffer {
|
||||||
|
defer func() {
|
||||||
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err == nil {
|
||||||
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
ctx = templ.InitializeContext(ctx)
|
||||||
|
ctx = templ.ClearChildren(ctx)
|
||||||
|
templ_7745c5c3_Var28 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||||
|
if !templ_7745c5c3_IsBuffer {
|
||||||
|
defer func() {
|
||||||
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err == nil {
|
||||||
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
ctx = templ.InitializeContext(ctx)
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "<form data-api=\"/auth/verify/resend\" data-next=\"/signup/sent\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = formError().Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "<p class=\"mb-4 text-sm text-muted\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var29 string
|
||||||
|
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.verify.resend_intro"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 89, Col: 79}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "</p>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = field(i18n.T(ctx, "auth.field.email"), "email", "email", "username", true).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = submit(i18n.T(ctx, "auth.verify.resend_submit")).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "</form><p class=\"mt-8 text-sm text-muted\"><a class=\"text-ink underline underline-offset-2\" href=\"/login\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var30 string
|
||||||
|
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.signup.to_login"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 93, Col: 137}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "</a></p>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var28), templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func newOrgForm() templ.Component {
|
||||||
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
|
return templ_7745c5c3_CtxErr
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||||
|
if !templ_7745c5c3_IsBuffer {
|
||||||
|
defer func() {
|
||||||
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err == nil {
|
||||||
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
ctx = templ.InitializeContext(ctx)
|
||||||
|
ctx = templ.ClearChildren(ctx)
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "<form data-api=\"/orgs\" data-next=\"/\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = formError().Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = field(i18n.T(ctx, "auth.field.org_name"), "name", "text", "organization", true).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = field(i18n.T(ctx, "auth.field.org_slug"), "slug", "text", "off", true).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = submit(i18n.T(ctx, "orgs.create")).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "</form>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOrgPage creates an organization: the first, in a page of its own
|
||||||
|
// since there is no console yet, or another one.
|
||||||
|
func NewOrgPage(p Page, me Me) templ.Component {
|
||||||
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
|
return templ_7745c5c3_CtxErr
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||||
|
if !templ_7745c5c3_IsBuffer {
|
||||||
|
defer func() {
|
||||||
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err == nil {
|
||||||
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
ctx = templ.InitializeContext(ctx)
|
||||||
|
ctx = templ.ClearChildren(ctx)
|
||||||
|
if len(me.Orgs) == 0 {
|
||||||
|
templ_7745c5c3_Var33 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||||
|
if !templ_7745c5c3_IsBuffer {
|
||||||
|
defer func() {
|
||||||
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err == nil {
|
||||||
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
ctx = templ.InitializeContext(ctx)
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "<p class=\"mb-6 text-sm text-muted\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var34 string
|
||||||
|
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "orgs.first_intro"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 111, Col: 71}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "</p>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = newOrgForm().Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "<p class=\"mt-8 text-sm text-muted\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var35 string
|
||||||
|
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "orgs.invited_hint"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 113, Col: 72}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "</p><button data-logout class=\"mt-4 text-sm underline underline-offset-2\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var36 string
|
||||||
|
templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 114, Col: 108}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "</button>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var33), templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
templ_7745c5c3_Var37 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||||
|
if !templ_7745c5c3_IsBuffer {
|
||||||
|
defer func() {
|
||||||
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err == nil {
|
||||||
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
ctx = templ.InitializeContext(ctx)
|
||||||
|
templ_7745c5c3_Err = settingsHeading("orgs.new_title", "orgs.new_intro").Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "<div class=\"max-w-sm\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = newOrgForm().Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "</div>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var37), templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
var _ = templruntime.GeneratedTemplate
|
var _ = templruntime.GeneratedTemplate
|
||||||
@@ -51,6 +51,7 @@ templ consoleShell(p Page, me Me) {
|
|||||||
} else if len(me.Orgs) == 1 {
|
} else if len(me.Orgs) == 1 {
|
||||||
<span class="text-muted">{ me.Orgs[0].Name }</span>
|
<span class="text-muted">{ me.Orgs[0].Name }</span>
|
||||||
}
|
}
|
||||||
|
<a href="/orgs/new" class="-ml-4 text-muted hover:text-ink" title={ i18n.T(ctx, "orgs.new_title") } aria-label={ i18n.T(ctx, "orgs.new_title") }>+</a>
|
||||||
<nav class="flex items-center gap-5 whitespace-nowrap">
|
<nav class="flex items-center gap-5 whitespace-nowrap">
|
||||||
<a href="/" class="text-muted hover:text-ink">{ i18n.T(ctx, "console.monitors.title") }</a>
|
<a href="/" class="text-muted hover:text-ink">{ i18n.T(ctx, "console.monitors.title") }</a>
|
||||||
if me.Can["statuspages.read"] {
|
if me.Can["statuspages.read"] {
|
||||||
|
|||||||
+306
-280
@@ -131,7 +131,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</select>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</select> ")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -149,129 +149,155 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "</span>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "</span> ")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "<nav class=\"flex items-center gap-5 whitespace-nowrap\"><a href=\"/\" class=\"text-muted hover:text-ink\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "<a href=\"/orgs/new\" class=\"-ml-4 text-muted hover:text-ink\" title=\"")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var6 string
|
var templ_7745c5c3_Var6 string
|
||||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title"))
|
templ_7745c5c3_Var6, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "orgs.new_title")).Resolve(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 55, Col: 90}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 54, Col: 101}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "</a> ")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "\" aria-label=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var7 string
|
||||||
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "orgs.new_title")).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 54, Col: 146}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "\">+</a><nav class=\"flex items-center gap-5 whitespace-nowrap\"><a href=\"/\" class=\"text-muted hover:text-ink\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var8 string
|
||||||
|
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 56, Col: 90}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "</a> ")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
if me.Can["statuspages.read"] {
|
if me.Can["statuspages.read"] {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "<a href=\"/statuspages\" class=\"text-muted hover:text-ink\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "<a href=\"/statuspages\" class=\"text-muted hover:text-ink\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var7 string
|
|
||||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.title"))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 57, Col: 91}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "</a> ")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if me.Can["incidents.read"] {
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "<a href=\"/incidents\" class=\"text-muted hover:text-ink\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var8 string
|
|
||||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.title"))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 60, Col: 93}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</a> <a href=\"/maintenance\" class=\"text-muted hover:text-ink\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var9 string
|
var templ_7745c5c3_Var9 string
|
||||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.title"))
|
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.title"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 61, Col: 97}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 58, Col: 91}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</a>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</a> ")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "</nav><nav class=\"ml-auto flex items-center gap-5 whitespace-nowrap\"><a href=\"/settings\" class=\"text-muted hover:text-ink\">")
|
if me.Can["incidents.read"] {
|
||||||
if templ_7745c5c3_Err != nil {
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "<a href=\"/incidents\" class=\"text-muted hover:text-ink\">")
|
||||||
return templ_7745c5c3_Err
|
if templ_7745c5c3_Err != nil {
|
||||||
}
|
return templ_7745c5c3_Err
|
||||||
var templ_7745c5c3_Var10 string
|
}
|
||||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.settings"))
|
var templ_7745c5c3_Var10 string
|
||||||
if templ_7745c5c3_Err != nil {
|
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.title"))
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 65, Col: 96}
|
if templ_7745c5c3_Err != nil {
|
||||||
}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 61, Col: 93}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
}
|
||||||
if templ_7745c5c3_Err != nil {
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||||
return templ_7745c5c3_Err
|
if templ_7745c5c3_Err != nil {
|
||||||
}
|
return templ_7745c5c3_Err
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "</a> ")
|
}
|
||||||
if templ_7745c5c3_Err != nil {
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "</a> <a href=\"/maintenance\" class=\"text-muted hover:text-ink\">")
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
if me.IsAdmin {
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "<a href=\"/admin\" class=\"font-medium hover:underline\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var11 string
|
var templ_7745c5c3_Var11 string
|
||||||
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.admin"))
|
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.title"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 67, Col: 93}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 62, Col: 97}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "</a> ")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "</a>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "<button data-logout class=\"text-muted hover:text-ink\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "</nav><nav class=\"ml-auto flex items-center gap-5 whitespace-nowrap\"><a href=\"/settings\" class=\"text-muted hover:text-ink\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var12 string
|
var templ_7745c5c3_Var12 string
|
||||||
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout"))
|
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.settings"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 69, Col: 94}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 66, Col: 96}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "</button>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "</a> ")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
if me.IsAdmin {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "<a href=\"/admin\" class=\"font-medium hover:underline\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var13 string
|
||||||
|
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.admin"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 68, Col: 93}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "</a> ")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "<button data-logout class=\"text-muted hover:text-ink\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var14 string
|
||||||
|
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 70, Col: 94}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "</button>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -279,45 +305,45 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "</nav></div></header>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</nav></div></header>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
if me.OrgSuspended {
|
if me.OrgSuspended {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "<div class=\"border-b border-down bg-down/10\" role=\"alert\"><p class=\"mx-auto max-w-5xl px-6 py-3 text-sm\"><strong>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "<div class=\"border-b border-down bg-down/10\" role=\"alert\"><p class=\"mx-auto max-w-5xl px-6 py-3 text-sm\"><strong>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var13 string
|
var templ_7745c5c3_Var15 string
|
||||||
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.org_suspended"))
|
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.org_suspended"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 77, Col: 51}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 78, Col: 51}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</strong> ")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "</strong> ")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
if me.SuspendedReason != "" {
|
if me.SuspendedReason != "" {
|
||||||
var templ_7745c5c3_Var14 string
|
var templ_7745c5c3_Var16 string
|
||||||
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(" " + i18n.T(ctx, "console.suspended_reason", "Reason", me.SuspendedReason))
|
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(" " + i18n.T(ctx, "console.suspended_reason", "Reason", me.SuspendedReason))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 79, Col: 83}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 80, Col: 83}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "</p></div>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</p></div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, " ")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, " ")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -333,7 +359,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, " <main class=\"mx-auto max-w-5xl px-6 py-10\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, " <main class=\"mx-auto max-w-5xl px-6 py-10\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -345,7 +371,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "</main>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "</main>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -382,7 +408,7 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
templ_7745c5c3_Var16 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
templ_7745c5c3_Var18 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||||
if !templ_7745c5c3_IsBuffer {
|
if !templ_7745c5c3_IsBuffer {
|
||||||
@@ -394,51 +420,51 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "<h1 class=\"mb-8 text-lg font-semibold\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "<h1 class=\"mb-8 text-lg font-semibold\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var17 string
|
var templ_7745c5c3_Var19 string
|
||||||
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.title"))
|
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.title"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 105, Col: 72}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 106, Col: 72}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "</h1><section class=\"max-w-md\"><h2 class=\"mb-1 text-xs font-medium uppercase tracking-wider text-muted\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "</h1><section class=\"max-w-md\"><h2 class=\"mb-1 text-xs font-medium uppercase tracking-wider text-muted\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var18 string
|
var templ_7745c5c3_Var20 string
|
||||||
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.heading"))
|
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.heading"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 107, Col: 114}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 108, Col: 114}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "</h2>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "</h2>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
if me.TOTP {
|
if me.TOTP {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "<p class=\"mb-1 text-sm\"><span class=\"text-up\">●</span> ")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "<p class=\"mb-1 text-sm\"><span class=\"text-up\">●</span> ")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var19 string
|
var templ_7745c5c3_Var21 string
|
||||||
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.active"))
|
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.active"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 109, Col: 98}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 110, Col: 98}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "</p>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "</p>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -446,25 +472,25 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer
|
templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer
|
||||||
templ_7745c5c3_Buffer := templ.GetBuffer()
|
templ_7745c5c3_Buffer := templ.GetBuffer()
|
||||||
var templ_7745c5c3_ElementScripts []templ.ComponentScript
|
var templ_7745c5c3_ElementScripts []templ.ComponentScript
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "<p class=\"")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "<p class=\"")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var20 = []any{"mb-6 text-sm", templ.KV("text-down", me.RecoveryCodesLeft < 3), templ.KV("text-muted", me.RecoveryCodesLeft >= 3)}
|
var templ_7745c5c3_Var22 = []any{"mb-6 text-sm", templ.KV("text-down", me.RecoveryCodesLeft < 3), templ.KV("text-muted", me.RecoveryCodesLeft >= 3)}
|
||||||
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var20...)
|
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var22...)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var21 string
|
var templ_7745c5c3_Var23 string
|
||||||
templ_7745c5c3_Var21, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.CSSClasses(templ_7745c5c3_Var20).String()).Resolve(ctx)
|
templ_7745c5c3_Var23, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.CSSClasses(templ_7745c5c3_Var22).String()).Resolve(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 1, Col: 0}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 1, Col: 0}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var21)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var23)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "\"")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "\"")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -478,33 +504,33 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
}
|
}
|
||||||
templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, ">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, ">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var22 string
|
var templ_7745c5c3_Var24 string
|
||||||
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.left", "Count", me.RecoveryCodesLeft))
|
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.left", "Count", me.RecoveryCodesLeft))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 111, Col: 75}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 112, Col: 75}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "</p><details class=\"mb-6\"><summary class=\"cursor-pointer text-sm text-muted hover:text-ink\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "</p><details class=\"mb-6\"><summary class=\"cursor-pointer text-sm text-muted hover:text-ink\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var23 string
|
var templ_7745c5c3_Var25 string
|
||||||
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.regenerate"))
|
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.regenerate"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 114, Col: 116}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 115, Col: 116}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "</summary><form data-api=\"/me/totp/recovery-codes\" data-show-codes class=\"mt-4\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "</summary><form data-api=\"/me/totp/recovery-codes\" data-show-codes class=\"mt-4\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -528,20 +554,20 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "</form></details> <details><summary class=\"cursor-pointer text-sm text-muted hover:text-ink\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "</form></details> <details><summary class=\"cursor-pointer text-sm text-muted hover:text-ink\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var24 string
|
var templ_7745c5c3_Var26 string
|
||||||
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.disable"))
|
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.disable"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 124, Col: 109}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 125, Col: 109}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "</summary><form data-api=\"/me/totp/disable\" data-next=\"/settings/security\" class=\"mt-4\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "</summary><form data-api=\"/me/totp/disable\" data-next=\"/settings/security\" class=\"mt-4\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -561,51 +587,51 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "</form></details>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "</form></details>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "<p class=\"mb-6 text-sm\"><span class=\"text-unknown\">●</span> ")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "<p class=\"mb-6 text-sm\"><span class=\"text-unknown\">●</span> ")
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var25 string
|
|
||||||
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.inactive"))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 133, Col: 105}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "</p><div data-totp-setup><button data-totp-start class=\"border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var26 string
|
|
||||||
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.start"))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 135, Col: 141}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "</button><div data-totp-panel hidden><img data-totp-qr alt=\"")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var27 string
|
var templ_7745c5c3_Var27 string
|
||||||
templ_7745c5c3_Var27, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "security.totp.qr_alt")).Resolve(ctx)
|
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.inactive"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 137, Col: 65}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 134, Col: 105}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var27)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "\" class=\"mb-3 h-48 w-48 border border-rule bg-white p-2\"><p class=\"mb-6 break-all font-mono text-xs text-muted\" data-totp-secret></p><form data-api=\"/me/totp/enable\" data-show-codes>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "</p><div data-totp-setup><button data-totp-start class=\"border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var28 string
|
||||||
|
templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.start"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 136, Col: 141}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "</button><div data-totp-panel hidden><img data-totp-qr alt=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var29 string
|
||||||
|
templ_7745c5c3_Var29, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "security.totp.qr_alt")).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 138, Col: 65}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var29)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "\" class=\"mb-3 h-48 w-48 border border-rule bg-white p-2\"><p class=\"mb-6 break-all font-mono text-xs text-muted\" data-totp-secret></p><form data-api=\"/me/totp/enable\" data-show-codes>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -625,121 +651,121 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "</form></div></div>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "</form></div></div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "</section><section class=\"mt-12 max-w-md\"><h2 class=\"mb-3 text-xs font-medium uppercase tracking-wider text-muted\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "</section><section class=\"mt-12 max-w-md\"><h2 class=\"mb-3 text-xs font-medium uppercase tracking-wider text-muted\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var28 string
|
var templ_7745c5c3_Var30 string
|
||||||
templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.heading"))
|
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.heading"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 150, Col: 113}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 151, Col: 113}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "</h2>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "</h2>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
if len(identities) == 0 {
|
if len(identities) == 0 {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "<p class=\"mb-4 text-sm text-muted\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "<p class=\"mb-4 text-sm text-muted\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var29 string
|
var templ_7745c5c3_Var31 string
|
||||||
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.none"))
|
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.none"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 152, Col: 73}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 153, Col: 73}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "</p>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "</p>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "<ul class=\"mb-4 divide-y divide-rule border-y border-rule text-sm\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "<ul class=\"mb-4 divide-y divide-rule border-y border-rule text-sm\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
for _, id := range identities {
|
for _, id := range identities {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "<li class=\"flex justify-between gap-4 py-2\"><span>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "<li class=\"flex justify-between gap-4 py-2\"><span>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var30 string
|
var templ_7745c5c3_Var32 string
|
||||||
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(id.Provider)
|
templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(id.Provider)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 156, Col: 69}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 157, Col: 69}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "</span><span class=\"font-mono text-xs text-muted\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "</span><span class=\"font-mono text-xs text-muted\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var31 string
|
var templ_7745c5c3_Var33 string
|
||||||
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(id.Email)
|
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(id.Email)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 156, Col: 131}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 157, Col: 131}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "</span></li>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "</span></li>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "</ul>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "</ul>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if canLink {
|
if canLink {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "<a href=\"")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "<a href=\"")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var32 string
|
var templ_7745c5c3_Var34 string
|
||||||
templ_7745c5c3_Var32, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/sso/" + me.ActiveSlug + "?link=1")).ResolveURL(ctx)
|
templ_7745c5c3_Var34, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/sso/" + me.ActiveSlug + "?link=1")).ResolveURL(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 161, Col: 64}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 162, Col: 64}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var32)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var34)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "\" class=\"inline-block border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "\" class=\"inline-block border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var33 string
|
var templ_7745c5c3_Var35 string
|
||||||
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.link"))
|
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.link"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 161, Col: 190}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 162, Col: 190}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "</a>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "</a>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "</section><section class=\"mt-12\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "</section><section class=\"mt-12\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -747,20 +773,20 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "<p class=\"mb-4 max-w-2xl text-sm text-muted\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "<p class=\"mb-4 max-w-2xl text-sm text-muted\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var34 string
|
var templ_7745c5c3_Var36 string
|
||||||
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.activity_intro"))
|
templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.activity_intro"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 166, Col: 88}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 167, Col: 88}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "</p>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "</p>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -768,7 +794,7 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "</section>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "</section>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -778,7 +804,7 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var16), templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var18), templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -805,33 +831,33 @@ func recoveryOutput() templ.Component {
|
|||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "<div data-recovery-output hidden class=\"mt-6 border border-ink p-4\"><p class=\"mb-3 text-sm\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "<div data-recovery-output hidden class=\"mt-6 border border-ink p-4\"><p class=\"mb-3 text-sm\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var36 string
|
var templ_7745c5c3_Var38 string
|
||||||
templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.save_now"))
|
templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.save_now"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 177, Col: 69}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 178, Col: 69}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "</p><ol data-recovery-list class=\"mb-4 grid grid-cols-2 gap-x-6 gap-y-1 font-mono text-sm\"></ol><a href=\"/settings/security\" class=\"text-sm underline underline-offset-2\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "</p><ol data-recovery-list class=\"mb-4 grid grid-cols-2 gap-x-6 gap-y-1 font-mono text-sm\"></ol><a href=\"/settings/security\" class=\"text-sm underline underline-offset-2\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var37 string
|
var templ_7745c5c3_Var39 string
|
||||||
templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.saved"))
|
templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.saved"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 179, Col: 116}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 180, Col: 116}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "</a></div>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "</a></div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -856,46 +882,46 @@ func policyBanner(msgID, actionID, href string) templ.Component {
|
|||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "<div class=\"border-b border-degraded/40 bg-degraded/10\"><p class=\"mx-auto max-w-5xl px-6 py-2 text-sm\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "<div class=\"border-b border-degraded/40 bg-degraded/10\"><p class=\"mx-auto max-w-5xl px-6 py-2 text-sm\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var39 string
|
|
||||||
templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, msgID))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 186, Col: 23}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, " <a href=\"")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var40 string
|
|
||||||
templ_7745c5c3_Var40, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(href)).ResolveURL(ctx)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 187, Col: 32}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var40)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "\" class=\"underline underline-offset-2\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var41 string
|
var templ_7745c5c3_Var41 string
|
||||||
templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, actionID))
|
templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, msgID))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 187, Col: 95}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 187, Col: 23}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "</a></p></div>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, " <a href=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var42 string
|
||||||
|
templ_7745c5c3_Var42, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(href)).ResolveURL(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 188, Col: 32}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var42)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "\" class=\"underline underline-offset-2\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var43 string
|
||||||
|
templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, actionID))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 188, Col: 95}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "</a></p></div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -920,46 +946,46 @@ func settingsLink(href, titleID, hintID string) templ.Component {
|
|||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "<a href=\"")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "<a href=\"")
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var43 string
|
|
||||||
templ_7745c5c3_Var43, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(href)).ResolveURL(ctx)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 193, Col: 30}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var43)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "\" class=\"block border border-rule p-4 hover:border-ink\"><span class=\"block font-medium\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var44 string
|
|
||||||
templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, titleID))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 194, Col: 56}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "</span> <span class=\"mt-1 block text-sm text-muted\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var45 string
|
var templ_7745c5c3_Var45 string
|
||||||
templ_7745c5c3_Var45, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, hintID))
|
templ_7745c5c3_Var45, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(href)).ResolveURL(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 195, Col: 67}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 194, Col: 30}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var45))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var45)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, "</span></a>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, "\" class=\"block border border-rule p-4 hover:border-ink\"><span class=\"block font-medium\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var46 string
|
||||||
|
templ_7745c5c3_Var46, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, titleID))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 195, Col: 56}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var46))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, "</span> <span class=\"mt-1 block text-sm text-muted\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var47 string
|
||||||
|
templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, hintID))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 196, Col: 67}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "</span></a>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -985,7 +1011,7 @@ func SettingsIndex(p Page, me Me) templ.Component {
|
|||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
templ_7745c5c3_Var47 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
templ_7745c5c3_Var49 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||||
if !templ_7745c5c3_IsBuffer {
|
if !templ_7745c5c3_IsBuffer {
|
||||||
@@ -1001,7 +1027,7 @@ func SettingsIndex(p Page, me Me) templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, "<div class=\"grid gap-4 sm:grid-cols-2 lg:grid-cols-3\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 78, "<div class=\"grid gap-4 sm:grid-cols-2 lg:grid-cols-3\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -1067,13 +1093,13 @@ func SettingsIndex(p Page, me Me) templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "</div>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 79, "</div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var47), templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var49), templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user