{ i18n.T(ctx, p.TitleID) }
+{ i18n.T(ctx, "consent.intro") }
+-
+ for _, d := range docs {
+
- { i18n.T(ctx, LegalTitleID(d.Kind)) } + } +
{ i18n.T(ctx, "consent.decline") }
+ @accountDataBody(me) +diff --git a/README.md b/README.md index f7844e6..c48a8d4 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ It is built for teams and hosting providers: organizations with members, roles a - **History:** charts and SLA from one hour to a year, per region; see what the checker saw (redirect chain, timing, certificate, response body). - **Status pages:** unlimited, custom domains with automatic TLS, themes, Markdown, legal notice; served from cache during outages. - **Organizations:** members, custom roles scoped to monitor groups or status pages, API tokens, OpenID Connect SSO per organization, sign-up and sign-in with providers such as Google, Microsoft or GitHub, enforced 2FA, audit log. -- **Privacy:** GDPR data export (JSON, PDF) and deletion, configurable retention, no telemetry. +- **Privacy:** GDPR data export (JSON, PDF) and deletion, also for suspended accounts; legal notice, privacy policy and terms of service, with versioned consent on sign-up and again after material changes; configurable retention, no telemetry. - **Operations:** three stateless binaries, horizontally scalable; TimescaleDB and Redis (Sentinel supported); OpenAPI documentation. ## Installation diff --git a/internal/api/apidocs.go b/internal/api/apidocs.go index 7513f81..ebd5cc3 100644 --- a/internal/api/apidocs.go +++ b/internal/api/apidocs.go @@ -60,8 +60,11 @@ var endpoints = []endpoint{ {method: "GET", path: "/api/v1/me/export", tag: "Account", summary: "Export all personal data (GDPR Art. 15, 20)", description: "`?format=pdf` returns a PDF instead of JSON.", resp: accountExport{}}, {method: "POST", path: "/api/v1/me/delete", tag: "Account", summary: "Delete the account (GDPR Art. 17)", sessionOnly: true, - description: "Refused with `owns_shared_orgs` while the user owns organizations with other members. Organizations only the user belongs to are deleted with the account.", + description: "Organizations the user owns are deleted with the account, with all their monitors, even when they have other members. Open to suspended accounts and to those that have not accepted the terms.", req: deletionRequest{}, resp: obj{"status": ""}}, + {method: "POST", path: "/api/v1/consent", tag: "Account", summary: "Accept the platform's privacy policy and terms", sessionOnly: true, + description: "`versions` are the versions shown, e.g. `privacy:12,terms:14`; `409 consent_outdated` when a document changed meanwhile. Until an account accepted the current versions, other requests of its sessions get `403 consent_required`.", + req: consentRequest{}, resp: obj{"redirect": ""}}, {method: "POST", path: "/api/v1/markdown/preview", tag: "Account", summary: "Render Markdown as pages will show it", req: previewRequest{}, resp: obj{"html": ""}}, {method: "POST", path: "/api/v1/invitations/:token/accept", tag: "Account", summary: "Accept an invitation with the signed-in account", sessionOnly: true, @@ -294,10 +297,10 @@ var endpoints = []endpoint{ perm: "platform admin", req: suspensionRequest{}, status: http.StatusNoContent}, {method: "DELETE", path: "/api/v1/admin/orgs/:id", tag: "Platform", summary: "Delete an organization with all its data", perm: "platform admin", status: http.StatusNoContent}, {method: "PUT", path: "/api/v1/admin/users/:id/suspension", tag: "Platform", summary: "Suspend or reinstate an account", - description: "A suspended account is signed out everywhere and can neither sign in nor use its API tokens. Platform admins cannot be suspended.", + description: "A suspended account is signed out everywhere and cannot use its API tokens; signing in again only lets it export or delete its data. Platform admins cannot be suspended.", perm: "platform admin", req: suspensionRequest{}, status: http.StatusNoContent}, {method: "DELETE", path: "/api/v1/admin/users/:id", tag: "Platform", summary: "Delete an account", - description: "Organizations only the account belongs to are deleted with it; owning one shared with others gives 409 owns_shared_orgs. Platform admins cannot be deleted.", + description: "Organizations the account owns are deleted with it. Platform admins cannot be deleted.", perm: "platform admin", status: http.StatusNoContent}, {method: "GET", path: "/api/v1/admin/regions", tag: "Platform", summary: "List platform regions", perm: "platform admin", resp: obj{"regions": []regionView{}}}, diff --git a/internal/api/audit.go b/internal/api/audit.go index 7a093ba..33a5ae5 100644 --- a/internal/api/audit.go +++ b/internal/api/audit.go @@ -37,6 +37,7 @@ var auditActions = map[string]string{ "POST /api/v1/auth/login": "auth.login", "POST /api/v1/auth/login/totp": "auth.login", "POST /api/v1/auth/logout": "auth.logout", + "POST /api/v1/consent": "account.consent", "POST /api/v1/me/org": "", "POST /api/v1/me/totp/setup": "", "POST /api/v1/me/totp/enable": "account.totp_enable", diff --git a/internal/api/auth.go b/internal/api/auth.go index e342f48..c76705d 100644 --- a/internal/api/auth.go +++ b/internal/api/auth.go @@ -35,6 +35,10 @@ type signupRequest struct { // after confirming. OrgName string `json:"org_name" binding:"max=200"` OrgSlug string `json:"org_slug" binding:"max=63"` + // Consent accepts the platform's privacy policy and terms in the + // versions the form showed (ConsentVersions, "privacy:12,terms:14"). + Consent bool `json:"consent"` + ConsentVersions string `json:"consent_versions" binding:"max=200"` } func (s *Server) signup(c *gin.Context) { @@ -60,6 +64,10 @@ func (s *Server) signup(c *gin.Context) { fail(c, http.StatusTooManyRequests, "signup_limit") return } + consent, ok := s.signupConsent(c, req.Consent, req.ConsentVersions) + if !ok { + return + } verify := s.verificationRequired() withOrg := !verify && strings.TrimSpace(req.OrgName) != "" && strings.TrimSpace(req.OrgSlug) != "" hash, err := auth.HashPassword(req.Password) @@ -103,6 +111,11 @@ func (s *Server) signup(c *gin.Context) { } return nil }) + if err == nil { + err = s.db.Tx(ctx, tenant.User(user.ID), func(q *store.Queries) error { + return recordConsent(ctx, q, user.ID, consent) + }) + } switch { case isUniqueViolation(err, "users_email_key"), isUniqueViolation(err, "users_email_key_idx"): fail(c, http.StatusConflict, "email_taken") @@ -195,12 +208,9 @@ func (s *Server) login(c *gin.Context) { invalidCredentials(c) return } - // Only someone who knows the password learns of the suspension or a - // missing confirmation. - if user.DisabledAt != nil { - fail(c, http.StatusForbidden, "account_suspended") - return - } + // Only someone who knows the password learns of a missing + // confirmation. Suspended accounts sign in, but only to export or + // delete their data. if user.EmailVerifiedAt == nil { fail(c, http.StatusForbidden, "email_unverified") return @@ -289,10 +299,6 @@ func (s *Server) finishLogin(c *gin.Context, userID uuid.UUID, method auth.Metho internalError(c, err) return } - if user.DisabledAt != nil { - fail(c, http.StatusForbidden, "account_suspended") - return - } var org uuid.UUID if len(orgs) > 0 { org = orgs[0].ID diff --git a/internal/api/consent.go b/internal/api/consent.go new file mode 100644 index 0000000..21069f8 --- /dev/null +++ b/internal/api/consent.go @@ -0,0 +1,357 @@ +package api + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "slices" + "strconv" + "strings" + + "github.com/gin-gonic/gin" + "github.com/google/uuid" + + "git.zb-server.de/ZB-Server/uptimesebi/internal/auth" + "git.zb-server.de/ZB-Server/uptimesebi/internal/store" + "git.zb-server.de/ZB-Server/uptimesebi/internal/tenant" + "git.zb-server.de/ZB-Server/uptimesebi/internal/web" +) + +// Every account accepts the platform's privacy policy and terms in their +// current version: on sign-up, and otherwise right after signing in, again +// whenever a document asks for it. Until then, and while an account is +// suspended, it can only read the documents, export its data, delete +// itself and sign out. + +// requiredConsent returns the current version of each document accounts +// accept; empty when the platform has none. +func (s *Server) requiredConsent(ctx context.Context) (map[string]int64, error) { + return s.consent.get(ctx, s.rdb, func(ctx context.Context) (map[string]int64, error) { + out := map[string]int64{} + err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error { + rows, err := q.RequiredLegalVersions(ctx) + for _, r := range rows { + out[r.Kind] = r.Version + } + return err + }) + return out, err + }) +} + +// consentVersions encodes versions for a form, e.g. "privacy:12,terms:14". +func consentVersions(v map[string]int64) string { + var parts []string + for _, kind := range web.ConsentKinds { + if n, ok := v[kind]; ok { + parts = append(parts, kind+":"+strconv.FormatInt(n, 10)) + } + } + return strings.Join(parts, ",") +} + +func parseConsentVersions(s string) map[string]int64 { + out := map[string]int64{} + for part := range strings.SplitSeq(s, ",") { + kind, n, ok := strings.Cut(strings.TrimSpace(part), ":") + if v, err := strconv.ParseInt(n, 10, 64); ok && err == nil { + out[kind] = v + } + } + return out +} + +// errConsentOutdated reports an acceptance of versions that are no longer +// current: a document changed while the form was open. +var errConsentOutdated = errors.New("api: consent for outdated documents") + +// checkConsent verifies that accepted covers exactly the documents +// required right now. +func checkConsent(required, accepted map[string]int64) error { + for kind, v := range required { + if accepted[kind] != v { + return errConsentOutdated + } + } + return nil +} + +func recordConsent(ctx context.Context, q *store.Queries, user uuid.UUID, versions map[string]int64) error { + for kind, v := range versions { + if err := q.AcceptLegal(ctx, store.AcceptLegalParams{UserID: user, Kind: kind, Version: v}); err != nil { + return err + } + } + return nil +} + +// access is what an account may do in the console. +type access struct { + suspended bool + reason string + // missing are the documents still to accept, with their versions. + missing map[string]int64 +} + +func (a access) restricted() bool { return a.suspended || len(a.missing) > 0 } + +func (s *Server) accessOf(ctx context.Context, user uuid.UUID) (access, error) { + required, err := s.requiredConsent(ctx) + if err != nil { + return access{}, err + } + var a access + err = s.db.Tx(ctx, tenant.User(user), func(q *store.Queries) error { + u, err := q.GetUser(ctx, user) + if err != nil { + return err + } + if u.DisabledAt != nil { + a.suspended, a.reason = true, u.DisabledReason + } + if len(required) == 0 { + return nil + } + accepted, err := q.AcceptedLegalVersions(ctx, user) + if err != nil { + return err + } + for kind, v := range required { + if !slices.ContainsFunc(accepted, func(r store.AcceptedLegalVersionsRow) bool { return r.Kind == kind && r.Version == v }) { + if a.missing == nil { + a.missing = map[string]int64{} + } + a.missing[kind] = v + } + } + return nil + }) + return a, err +} + +// restrictedPaths stay open to accounts that are suspended or have yet to +// accept the documents. Admins keep editing the documents, which they may +// be publishing one after the other; the handlers still check they are. +var restrictedPaths = []string{ + "/consent", "/account/suspended", "/legal/", + "/api/v1/auth/", "/api/v1/consent", "/api/v1/me/export", "/api/v1/me/delete", "/api/v1/locale", + "/admin/legal", "/api/v1/admin/legal/", +} + +func allowedRestricted(path string) bool { + return slices.ContainsFunc(restrictedPaths, func(p string) bool { + return path == p || (strings.HasSuffix(p, "/") && strings.HasPrefix(path, p)) + }) +} + +// accountGate keeps restricted accounts on the consent or suspension page. +func (s *Server) accountGate() gin.HandlerFunc { + return func(c *gin.Context) { + sess := auth.Current(c) + path := c.Request.URL.Path + if sess == nil || allowedRestricted(path) { + c.Next() + return + } + a, err := s.accessOf(c.Request.Context(), sess.UserID) + switch { + case err != nil: + internalError(c, err) + c.Abort() + return + case !a.restricted(): + c.Next() + return + } + if strings.HasPrefix(path, "/api/") { + code := "consent_required" + if a.suspended { + code = "account_suspended" + } + fail(c, http.StatusForbidden, code) + c.Abort() + return + } + target := "/account/suspended" + if !a.suspended { + target = "/consent?next=" + url.QueryEscape(c.Request.URL.RequestURI()) + } + c.Redirect(http.StatusSeeOther, target) + c.Abort() + } +} + +// localNext keeps a redirect target on this site. +func localNext(next string) string { + if !strings.HasPrefix(next, "/") || strings.HasPrefix(next, "//") || strings.HasPrefix(next, "/\\") { + return "/" + } + return next +} + +type consentRequest struct { + // Versions are the documents accepted, as shown: "privacy:12,terms:14". + Versions string `json:"versions" binding:"max=200"` + Next string `json:"next" binding:"max=2000"` +} + +// acceptConsent records that the signed-in account accepts the current +// documents. +func (s *Server) acceptConsent(c *gin.Context) { + var req consentRequest + if !bind(c, &req) { + return + } + sess := auth.Current(c) + if sess == nil { + fail(c, http.StatusUnauthorized, "unauthenticated") + return + } + ctx := c.Request.Context() + required, err := s.requiredConsent(ctx) + if err != nil { + internalError(c, err) + return + } + accepted := parseConsentVersions(req.Versions) + if err := checkConsent(required, accepted); err != nil { + fail(c, http.StatusConflict, "consent_outdated") + return + } + auditDetail(c, "versions", consentVersions(required)) + if err := s.db.Tx(ctx, tenant.User(sess.UserID), func(q *store.Queries) error { + return recordConsent(ctx, q, sess.UserID, required) + }); err != nil { + internalError(c, err) + return + } + c.JSON(http.StatusOK, gin.H{"redirect": localNext(req.Next)}) +} + +// consentDocs lists the documents of versions with their links. +func (s *Server) consentDocs(ctx context.Context, versions map[string]int64) []web.LegalLink { + var docs []web.LegalLink + for _, l := range web.LegalLinks(s.platformLegalDocs(ctx), "/legal/") { + if _, ok := versions[l.Kind]; ok { + docs = append(docs, l) + } + } + return docs +} + +// restrictedMe is the account data the consent and suspension pages show, +// with the organizations its deletion would take along. +func (s *Server) restrictedMe(c *gin.Context, sess *auth.Session) (web.Me, error) { + m, err := s.loadMe(c.Request.Context(), sess) + if err != nil { + return web.Me{}, err + } + me := toWebMe(m) + me.DeletesOrgs, err = s.ownedOrgs(c.Request.Context(), sess.UserID) + return me, err +} + +func (s *Server) consentPage(c *gin.Context) { + sess := auth.Current(c) + if sess == nil { + c.Redirect(http.StatusSeeOther, "/login") + return + } + next := localNext(c.Query("next")) + a, err := s.accessOf(c.Request.Context(), sess.UserID) + if err != nil { + internalError(c, err) + return + } + if a.suspended { + c.Redirect(http.StatusSeeOther, "/account/suspended") + return + } + if len(a.missing) == 0 { + c.Redirect(http.StatusSeeOther, next) + return + } + me, err := s.restrictedMe(c, sess) + if err != nil { + internalError(c, err) + return + } + required, err := s.requiredConsent(c.Request.Context()) + if err != nil { + internalError(c, err) + return + } + web.Render(c, http.StatusOK, web.ConsentPage(s.pageFor(c, "consent.title"), me, + s.consentDocs(c.Request.Context(), a.missing), consentVersions(required), next)) +} + +func (s *Server) suspendedPage(c *gin.Context) { + sess := auth.Current(c) + if sess == nil { + c.Redirect(http.StatusSeeOther, "/login") + return + } + a, err := s.accessOf(c.Request.Context(), sess.UserID) + if err != nil { + internalError(c, err) + return + } + if !a.suspended { + c.Redirect(http.StatusSeeOther, "/") + return + } + me, err := s.restrictedMe(c, sess) + if err != nil { + internalError(c, err) + return + } + web.Render(c, http.StatusOK, web.SuspendedPage(s.pageFor(c, "suspended.title"), me, a.reason)) +} + +// signupConsent checks the consent given on a sign-up form and returns the +// versions to record. +func (s *Server) signupConsent(c *gin.Context, given bool, versions string) (map[string]int64, bool) { + required, err := s.requiredConsent(c.Request.Context()) + if err != nil { + internalError(c, err) + return nil, false + } + if len(required) == 0 { + return nil, true + } + if !given { + fail(c, http.StatusUnprocessableEntity, "consent_required") + return nil, false + } + if err := checkConsent(required, parseConsentVersions(versions)); err != nil { + fail(c, http.StatusConflict, "consent_outdated") + return nil, false + } + return required, true +} + +// signupConsentView is what sign-up forms show: the documents to accept +// and their versions. +func (s *Server) signupConsentView(ctx context.Context) (web.SignupConsent, error) { + required, err := s.requiredConsent(ctx) + if err != nil || len(required) == 0 { + return web.SignupConsent{}, err + } + return web.SignupConsent{Docs: s.consentDocs(ctx, required), Versions: consentVersions(required)}, nil +} + +// ownedOrgs names the organizations user owns, which deleting the account +// deletes too. +func (s *Server) ownedOrgs(ctx context.Context, user uuid.UUID) ([]string, error) { + var out []string + err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error { + owned, err := q.OwnedOrgs(ctx, user) + for _, o := range owned { + out = append(out, fmt.Sprintf("%s (%s)", o.Name, o.Slug)) + } + return err + }) + return out, err +} diff --git a/internal/api/consent_test.go b/internal/api/consent_test.go new file mode 100644 index 0000000..20aa496 --- /dev/null +++ b/internal/api/consent_test.go @@ -0,0 +1,193 @@ +package api_test + +import ( + "context" + "net/http" + "strings" + "testing" + + "github.com/google/uuid" + "github.com/jackc/pgx/v5" + + "git.zb-server.de/ZB-Server/uptimesebi/internal/sso/ssotest" + "git.zb-server.de/ZB-Server/uptimesebi/internal/store" + "git.zb-server.de/ZB-Server/uptimesebi/internal/tenant" +) + +func TestConsent(t *testing.T) { + e := newEnv(t) + ctx := context.Background() + admin := e.browser(t) + admin.signup("a@"+uniq("cs")+".test", uniq("cs-")) + if err := tenant.New(e.dbPool).Tx(ctx, tenant.Global(), func(q *store.Queries) error { + return q.MakeAdmin(ctx, admin.userIDSelf()) + }); err != nil { + t.Fatal(err) + } + earlier := e.browser(t) + earlier.signup("e@"+uniq("cs")+".test", uniq("cs-")) + t.Cleanup(func() { clearPlatformLegal(admin) }) + + for kind, text := range map[string]string{"privacy": "# Datenschutz", "terms": "# AGB"} { + if st, body := admin.do("PUT", "/api/v1/admin/legal/"+kind, map[string]any{"markdown": text}); st != http.StatusNoContent { + t.Fatalf("set %s = %d %v", kind, st, body) + } + } + admin.acceptConsent() + if _, _, html := e.browser(t).page("/login"); !strings.Contains(html, `href="/legal/terms"`) { + t.Error("the footer lacks the terms") + } + if st, body := admin.do("PUT", "/api/v1/org/legal/terms", map[string]any{"markdown": "x"}); st != http.StatusNotFound { + t.Errorf("organization sets terms = %d %v, want 404", st, body) + } + + // Signing up needs the box ticked for the versions shown. + visitor := e.browser(t) + _, _, form := visitor.page("/signup") + versions := consentShown(form) + if !strings.Contains(versions, "privacy:") || !strings.Contains(versions, "terms:") || !strings.Contains(form, `name="consent" required`) { + t.Fatalf("sign-up form lacks the consent box: versions %q", versions) + } + signup := func(consent bool, versions string) (int, map[string]any) { + return e.browser(t).do("POST", "/api/v1/auth/signup", map[string]any{ + "email": uniq("n") + "@example.test", "password": password, "consent": consent, "consent_versions": versions, + }) + } + st, body := signup(false, versions) + expect(t, "sign up without consent", st, body, http.StatusUnprocessableEntity, "consent_required") + st, body = signup(true, "privacy:1,terms:1") + expect(t, "sign up with outdated versions", st, body, http.StatusConflict, "consent_outdated") + email := uniq("n") + "@example.test" + fresh := e.browser(t) + if st, body := fresh.do("POST", "/api/v1/auth/signup", map[string]any{ + "email": email, "password": password, "consent": true, "consent_versions": versions, + }); st != http.StatusOK { + t.Fatalf("sign up with consent = %d %v", st, body) + } + freshID := fresh.userIDSelf() + if n := e.count(t, `SELECT count(*) FROM legal_acceptances WHERE user_id = $1`, freshID); n != 2 { + t.Errorf("recorded %d acceptances, want 2", n) + } + if got := fresh.visit("/"); got.Path == "/consent" { + t.Error("an account that accepted on sign-up is asked again") + } + + // Accounts from before have to accept first; until then they can read + // the documents, take their data along and sign out. + if got := earlier.visit("/"); got.Path != "/consent" || got.Query().Get("next") != "/" { + t.Errorf("console before consent landed on %s", got) + } + st, body = earlier.do("GET", "/api/v1/org/monitors", nil) + expect(t, "API before consent", st, body, http.StatusForbidden, "consent_required") + for _, path := range []string{"/legal/terms", "/api/v1/me/export"} { + if st, _, _ := earlier.page(path); st != http.StatusOK { + t.Errorf("GET %s before consent = %d", path, st) + } + } + _, _, page := earlier.page("/consent") + if !strings.Contains(page, "Delete account") || !strings.Contains(page, `href="/legal/terms"`) { + t.Error("the consent page offers no way out or lacks the documents") + } + st, body = earlier.do("POST", "/api/v1/consent", map[string]any{"versions": "terms:1", "next": "/"}) + expect(t, "accept outdated versions", st, body, http.StatusConflict, "consent_outdated") + if st, body := earlier.do("POST", "/api/v1/consent", map[string]any{"versions": consentShown(page), "next": "//evil.example"}); st != http.StatusOK || body["redirect"] != "/" { + t.Errorf("accept = %d %v, want a local redirect", st, body) + } + if st, _ := earlier.do("GET", "/api/v1/org/monitors", nil); st != http.StatusOK { + t.Errorf("API after consent = %d", st) + } + + // A correction asks nobody again; a new version asks everyone. + admin.do("PUT", "/api/v1/admin/legal/terms", map[string]any{"markdown": "# AGB\n\nTippfehler behoben"}) + if got := earlier.visit("/"); got.Path == "/consent" { + t.Error("a correction asked for consent again") + } + admin.do("PUT", "/api/v1/admin/legal/terms", map[string]any{"markdown": "# AGB v2", "new_version": true}) + if got := earlier.visit("/"); got.Path != "/consent" { + t.Errorf("a new version of the terms was not put before the account: %s", got) + } + if _, _, page := earlier.page("/consent"); !strings.Contains(page, `href="/legal/terms"`) || strings.Contains(page, `
{ i18n.T(ctx, "consent.sso_hint") }
+ } } else {{ i18n.T(ctx, "consent.intro") }
+{ i18n.T(ctx, "consent.decline") }
+ @accountDataBody(me) +{ i18n.T(ctx, "suspended.intro") }
+ if reason != "" { +{ reason }
+ } +{ i18n.T(ctx, "suspended.options") }
+ + @accountDataBody(me) +") + 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, "consent.sso_hint")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 115, Col: 72} + } + _, 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, 36, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "
") 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.sent")) + var templ_7745c5c3_Var32 string + templ_7745c5c3_Var32, 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: 93, Col: 54} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 130, Col: 54} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var24 string - templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.verify.sent_hint")) + var templ_7745c5c3_Var33 string + templ_7745c5c3_Var33, 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: 94, Col: 75} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 131, Col: 75} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var22), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var31), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -558,7 +725,7 @@ func Verify(p Page, token string) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var27 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var36 := 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 { @@ -571,38 +738,38 @@ func Verify(p Page, token string) templ.Component { } ctx = templ.InitializeContext(ctx) if token == "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "
") 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, "error.verification_expired")) + var templ_7745c5c3_Var37 string + templ_7745c5c3_Var37, 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: 103, Col: 65} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 140, Col: 65} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } return nil }) - templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var27), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var36), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -689,7 +856,7 @@ func ResendVerification(p Page) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var34 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var43 := 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 { @@ -701,7 +868,7 @@ func ResendVerification(p Page) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var34), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var43), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -778,7 +945,7 @@ func newOrgForm() templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -826,7 +993,7 @@ func NewOrgPage(p Page, me Me) templ.Component { ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) if len(me.Orgs) == 0 { - templ_7745c5c3_Var39 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var48 := 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 { @@ -838,20 +1005,20 @@ func NewOrgPage(p Page, me Me) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var40 string - templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "orgs.first_intro")) + var templ_7745c5c3_Var49 string + templ_7745c5c3_Var49, 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: 143, Col: 71} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 180, Col: 71} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -859,44 +1026,44 @@ func NewOrgPage(p Page, me Me) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var41 string - templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "orgs.invited_hint")) + var templ_7745c5c3_Var50 string + templ_7745c5c3_Var50, 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: 145, Col: 72} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 182, Col: 72} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var50)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var39), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var48), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Var43 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var52 := 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 { @@ -912,7 +1079,7 @@ func NewOrgPage(p Page, me Me) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var56 string + templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "consent.intro")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 205, Col: 57} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var56)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var65 string + templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "consent.decline")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 227, Col: 71} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var65)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = accountDataBody(me).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 88, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var69 string + templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "suspended.intro")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 244, Col: 59} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var69)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if reason != "" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var70 string + templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(reason) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 246, Col: 64} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 95, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var71 string + templ_7745c5c3_Var71, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "suspended.options")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 248, Col: 72} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var71)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 96, "
{ i18n.T(ctx, "gdpr.account_export_intro") }
@exportLinks("/api/v1/me/export"){ i18n.T(ctx, "gdpr.delete_account_intro") }
+ if len(me.DeletesOrgs) > 0 { +{ i18n.T(ctx, "gdpr.deletes_orgs") }
+") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "
") 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, "gdpr.account_export_intro")) + var templ_7745c5c3_Var9 string + templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "gdpr.account_export_intro")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/gdpr.templ`, Line: 25, Col: 79} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/gdpr.templ`, Line: 32, Col: 79} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) + _, 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, 8, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -168,46 +199,92 @@ func accountDataSection(me Me) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "
") 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, "gdpr.org_export_intro")) + var templ_7745c5c3_Var17 string + templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "gdpr.org_export_intro")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/gdpr.templ`, Line: 40, Col: 75} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/gdpr.templ`, Line: 56, Col: 75} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) + _, 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, 17, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -287,46 +364,46 @@ func orgDataSection(me Me) templ.Component { return templ_7745c5c3_Err } if me.IsOwner { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var16 string - templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "gdpr.delete_org_intro")) + var templ_7745c5c3_Var19 string + templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "gdpr.delete_org_intro")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/gdpr.templ`, Line: 44, Col: 76} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/gdpr.templ`, Line: 60, Col: 76} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) + _, 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, 20, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "{ i18n.T(ctx, "legal.hint") }
+ if d.Consent { + @checkbox(i18n.T(ctx, "legal.new_version"), "new_version", false) +{ i18n.T(ctx, "legal.new_version_hint") }
+ } @submit(i18n.T(ctx, "common.save")) diff --git a/internal/web/legal_templ.go b/internal/web/legal_templ.go index 994bb17..80ed4bd 100644 --- a/internal/web/legal_templ.go +++ b/internal/web/legal_templ.go @@ -415,6 +415,9 @@ type LegalForm struct { Kind string URL string Markdown string + // Consent marks documents every account accepts, which can be put + // before everyone again. + Consent bool } // LegalSettingsPage edits legal documents. apiBase plus the kind is the @@ -468,7 +471,7 @@ func LegalSettingsPage(p Page, me Me, titleID, introID, apiBase, next string, do var templ_7745c5c3_Var22 string templ_7745c5c3_Var22, templ_7745c5c3_Err = templruntime.NewAttributeExpression(apiBase + d.Kind).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/legal.templ`, Line: 95, Col: 37} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/legal.templ`, Line: 98, Col: 37} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var22) if templ_7745c5c3_Err != nil { @@ -481,7 +484,7 @@ func LegalSettingsPage(p Page, me Me, titleID, introID, apiBase, next string, do var templ_7745c5c3_Var23 string templ_7745c5c3_Var23, templ_7745c5c3_Err = templruntime.NewAttributeExpression(next).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/legal.templ`, Line: 95, Col: 74} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/legal.templ`, Line: 98, Col: 74} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var23) if templ_7745c5c3_Err != nil { @@ -502,7 +505,7 @@ func LegalSettingsPage(p Page, me Me, titleID, introID, apiBase, next string, do var templ_7745c5c3_Var24 string templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "legal.url")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/legal.templ`, Line: 98, Col: 113} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/legal.templ`, Line: 101, Col: 113} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) if templ_7745c5c3_Err != nil { @@ -515,7 +518,7 @@ func LegalSettingsPage(p Page, me Me, titleID, introID, apiBase, next string, do var templ_7745c5c3_Var25 string templ_7745c5c3_Var25, templ_7745c5c3_Err = templruntime.NewAttributeExpression(d.URL).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/legal.templ`, Line: 99, Col: 48} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/legal.templ`, Line: 102, Col: 48} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var25) if templ_7745c5c3_Err != nil { @@ -528,7 +531,7 @@ func LegalSettingsPage(p Page, me Me, titleID, introID, apiBase, next string, do var templ_7745c5c3_Var26 string templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "legal.markdown")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/legal.templ`, Line: 102, Col: 118} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/legal.templ`, Line: 105, Col: 118} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) if templ_7745c5c3_Err != nil { @@ -549,7 +552,7 @@ func LegalSettingsPage(p Page, me Me, titleID, introID, apiBase, next string, do var templ_7745c5c3_Var27 string templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "legal.hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/legal.templ`, Line: 105, Col: 67} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/legal.templ`, Line: 108, Col: 67} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) if templ_7745c5c3_Err != nil { @@ -559,11 +562,34 @@ func LegalSettingsPage(p Page, me Me, titleID, introID, apiBase, next string, do if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + if d.Consent { + templ_7745c5c3_Err = checkbox(i18n.T(ctx, "legal.new_version"), "new_version", false).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "") + 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, "legal.new_version_hint")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/legal.templ`, Line: 111, Col: 91} + } + _, 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, 37, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } templ_7745c5c3_Err = submit(i18n.T(ctx, "common.save")).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/web/org.templ b/internal/web/org.templ index 6a6e2bc..99f8e4b 100644 --- a/internal/web/org.templ +++ b/internal/web/org.templ @@ -438,6 +438,7 @@ type Invitation struct { Email string SignedInAs string AccountExists bool + Consent SignupConsent } templ InvitationPage(p Page, v Invitation) { @@ -463,6 +464,7 @@ templ InvitationPage(p Page, v Invitation) { @formError() @field(i18n.T(ctx, "auth.field.name"), "display_name", "text", "name", false) @field(i18n.T(ctx, "auth.field.new_password", "Min", auth.MinPasswordLength), "password", "password", "new-password", true) + @consentField(v.Consent) @submit(i18n.T(ctx, "invite.create_account")) } diff --git a/internal/web/org_templ.go b/internal/web/org_templ.go index 7174a07..3b3955c 100644 --- a/internal/web/org_templ.go +++ b/internal/web/org_templ.go @@ -1824,6 +1824,7 @@ type Invitation struct { Email string SignedInAs string AccountExists bool + Consent SignupConsent } func InvitationPage(p Page, v Invitation) templ.Component { @@ -1863,7 +1864,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var84 string templ_7745c5c3_Var84, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.invitation_invalid")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 446, Col: 63} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 447, Col: 63} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var84)) if templ_7745c5c3_Err != nil { @@ -1881,7 +1882,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var85 string templ_7745c5c3_Var85, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "invite.summary", "Org", v.OrgName, "Role", v.RoleName)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 448, Col: 96} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 449, Col: 96} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var85)) if templ_7745c5c3_Err != nil { @@ -1894,7 +1895,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var86 string templ_7745c5c3_Var86, templ_7745c5c3_Err = templ.JoinStringErrs(v.Email) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 449, Col: 46} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 450, Col: 46} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var86)) if templ_7745c5c3_Err != nil { @@ -1913,7 +1914,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var87 string templ_7745c5c3_Var87, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/invitations/" + v.Token + "/accept").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 452, Col: 59} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 453, Col: 59} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var87) if templ_7745c5c3_Err != nil { @@ -1943,7 +1944,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var88 string templ_7745c5c3_Var88, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.invitation_email_mismatch")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 457, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 458, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var88)) if templ_7745c5c3_Err != nil { @@ -1956,7 +1957,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var89 string templ_7745c5c3_Var89, 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/org.templ`, Line: 458, Col: 110} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 459, Col: 110} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var89)) if templ_7745c5c3_Err != nil { @@ -1974,7 +1975,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var90 string templ_7745c5c3_Var90, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/login?next=/invite/" + v.Token)).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 460, Col: 62} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 461, Col: 62} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var90) if templ_7745c5c3_Err != nil { @@ -1987,7 +1988,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var91 string templ_7745c5c3_Var91, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "invite.sign_in")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 460, Col: 153} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 461, Col: 153} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var91)) if templ_7745c5c3_Err != nil { @@ -2005,7 +2006,7 @@ func InvitationPage(p Page, v Invitation) templ.Component { var templ_7745c5c3_Var92 string templ_7745c5c3_Var92, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/invitations/" + v.Token + "/signup").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 462, Col: 59} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 463, Col: 59} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var92) if templ_7745c5c3_Err != nil { @@ -2027,6 +2028,10 @@ func InvitationPage(p Page, v Invitation) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + templ_7745c5c3_Err = consentField(v.Consent).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } templ_7745c5c3_Err = submit(i18n.T(ctx, "invite.create_account")).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err @@ -2079,7 +2084,7 @@ func tokenUsage() templ.Component { var templ_7745c5c3_Var94 string templ_7745c5c3_Var94, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.usage")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 483, Col: 31} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 485, Col: 31} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var94)) if templ_7745c5c3_Err != nil { @@ -2092,7 +2097,7 @@ func tokenUsage() templ.Component { var templ_7745c5c3_Var95 string templ_7745c5c3_Var95, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "apidocs.title")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 486, Col: 98} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 488, Col: 98} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var95)) if templ_7745c5c3_Err != nil {