feat(api): let each organization sign in through its own identity provider
Owners manage OIDC providers under /settings/sso. Users start at /sso/<org>. New users can be provisioned for verified emails in allowed domains; existing accounts are never matched by email and must link their SSO sign-in while signed in. Closes #4 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
9ad5f29f1b
commit
3f21361995
19 files changed
+2731
-231
No files matched your search
@@ -8,3 +8,8 @@ UPTIME_CHECKER_REGION=local
|
|||||||
|
|
||||||
# Generate with: echo "k1:$(head -c32 /dev/urandom | base64)"
|
# Generate with: echo "k1:$(head -c32 /dev/urandom | base64)"
|
||||||
UPTIME_SECRET_KEYS=dev:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
UPTIME_SECRET_KEYS=dev:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
||||||
|
|
||||||
|
UPTIME_PUBLIC_URL=http://localhost:8080
|
||||||
|
# Lets organizations use IdPs on private networks (e.g. an internal Keycloak).
|
||||||
|
# auto = allowed for UPTIME_EDITION=selfhosted, denied for cloud.
|
||||||
|
UPTIME_SSO_ALLOW_PRIVATE_NETWORKS=auto
|
||||||
+101
-1
@@ -2,11 +2,15 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/a-h/templ"
|
"github.com/a-h/templ"
|
||||||
"github.com/gin-gonic/gin"
|
"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/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"
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/web"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -14,7 +18,16 @@ 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("/", s.page("console.monitors.title", web.Dashboard))
|
r.GET("/", s.page("console.monitors.title", web.Dashboard))
|
||||||
r.GET("/settings/security", s.page("security.title", web.Security))
|
r.GET("/settings/security", s.securityPage)
|
||||||
|
r.GET("/settings/sso", s.ssoSettingsPage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// flashErrors lists the codes a redirect may ask a page to display. Anything
|
||||||
|
// else in the query string is ignored so links cannot inject messages.
|
||||||
|
var flashErrors = map[ssoError]bool{
|
||||||
|
"sso_unavailable": true, "sso_provider_error": true, "sso_expired": true,
|
||||||
|
"sso_denied": true, "sso_not_member": true, "sso_not_provisioned": true,
|
||||||
|
"sso_link_required": true, "sso_identity_taken": true, "invalid_credentials": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) pageFor(c *gin.Context, titleID string) web.Page {
|
func (s *Server) pageFor(c *gin.Context, titleID string) web.Page {
|
||||||
@@ -22,6 +35,12 @@ func (s *Server) pageFor(c *gin.Context, titleID string) web.Page {
|
|||||||
if sess := auth.Current(c); sess != nil {
|
if sess := auth.Current(c); sess != nil {
|
||||||
p.CSRF = sess.CSRF
|
p.CSRF = sess.CSRF
|
||||||
}
|
}
|
||||||
|
if code := ssoError(c.Query("sso_error")); flashErrors[code] {
|
||||||
|
p.ErrorID = "error." + string(code)
|
||||||
|
}
|
||||||
|
if c.Query("sso") == "linked" {
|
||||||
|
p.NoticeID = "security.sso.linked"
|
||||||
|
}
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +86,83 @@ func (s *Server) page(titleID string, view func(web.Page, web.Me) templ.Componen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) securityPage(c *gin.Context) {
|
||||||
|
sess := auth.Current(c)
|
||||||
|
if sess == nil {
|
||||||
|
c.Redirect(http.StatusSeeOther, "/login")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
me, err := s.loadMe(ctx, sess)
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var (
|
||||||
|
identities []web.Identity
|
||||||
|
canLink bool
|
||||||
|
)
|
||||||
|
if sess.OrgID != uuid.Nil {
|
||||||
|
err = s.db.Tx(ctx, tenant.Org(sess.OrgID, sess.UserID), func(q *store.Queries) error {
|
||||||
|
rows, err := q.ListUserIdentitiesInOrg(ctx, sess.UserID)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, r := range rows {
|
||||||
|
identities = append(identities, web.Identity{Provider: r.ProviderName, Email: deref(r.Email)})
|
||||||
|
}
|
||||||
|
providers, err := q.ListEnabledSSOProviders(ctx)
|
||||||
|
canLink = len(providers) > 0
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
web.Render(c, http.StatusOK, web.Security(s.pageFor(c, "security.title"), toWebMe(me), identities, canLink))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) ssoSettingsPage(c *gin.Context) {
|
||||||
|
sess := auth.Current(c)
|
||||||
|
if sess == nil {
|
||||||
|
c.Redirect(http.StatusSeeOther, "/login")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
me, err := s.loadMe(ctx, sess)
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
wm := toWebMe(me)
|
||||||
|
if !wm.IsOwner {
|
||||||
|
c.Redirect(http.StatusSeeOther, "/")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var rows []store.SsoProvider
|
||||||
|
err = s.db.Tx(ctx, tenant.Org(sess.OrgID, sess.UserID), func(q *store.Queries) error {
|
||||||
|
rows, err = q.ListSSOProviders(ctx)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
view := web.SSOSettings{
|
||||||
|
RedirectURL: s.sso.RedirectURL(),
|
||||||
|
LoginURL: s.cfg.PublicURL + "/sso/" + wm.ActiveSlug,
|
||||||
|
}
|
||||||
|
for _, r := range rows {
|
||||||
|
view.Providers = append(view.Providers, web.SSOProvider{
|
||||||
|
ID: r.ID.String(), Name: r.Name, Issuer: r.Issuer, ClientID: r.ClientID,
|
||||||
|
HasSecret: r.ClientSecret != nil, AllowedDomains: strings.Join(r.AllowedDomains, ", "),
|
||||||
|
AutoProvision: r.AutoProvision, Enabled: r.Enabled,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
web.Render(c, http.StatusOK, web.SSOSettingsPage(s.pageFor(c, "sso.settings.title"), wm, view))
|
||||||
|
}
|
||||||
|
|
||||||
func toWebMe(m meView) web.Me {
|
func toWebMe(m meView) web.Me {
|
||||||
out := web.Me{
|
out := web.Me{
|
||||||
Email: m.Email,
|
Email: m.Email,
|
||||||
@@ -77,6 +173,10 @@ func toWebMe(m meView) web.Me {
|
|||||||
}
|
}
|
||||||
for _, o := range m.Orgs {
|
for _, o := range m.Orgs {
|
||||||
out.Orgs = append(out.Orgs, web.Org{ID: o.ID.String(), Name: o.Name, Slug: o.Slug, IsOwner: o.IsOwner})
|
out.Orgs = append(out.Orgs, web.Org{ID: o.ID.String(), Name: o.Name, Slug: o.Slug, IsOwner: o.IsOwner})
|
||||||
|
if o.ID == m.ActiveOrg {
|
||||||
|
out.IsOwner = o.IsOwner
|
||||||
|
out.ActiveSlug = o.Slug
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,7 @@ import (
|
|||||||
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
||||||
"git.zb-server.de/ZB-Server/uptimesebi/internal/requestid"
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/requestid"
|
||||||
"git.zb-server.de/ZB-Server/uptimesebi/internal/sealed"
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/sealed"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/sso"
|
||||||
"git.zb-server.de/ZB-Server/uptimesebi/internal/store"
|
"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/tenant"
|
||||||
)
|
)
|
||||||
@@ -33,6 +34,7 @@ type Server struct {
|
|||||||
sessions *auth.Sessions
|
sessions *auth.Sessions
|
||||||
limiter *auth.Limiter
|
limiter *auth.Limiter
|
||||||
totp *auth.TOTPVerifier
|
totp *auth.TOTPVerifier
|
||||||
|
sso *sso.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deps are the external resources a Server needs.
|
// Deps are the external resources a Server needs.
|
||||||
@@ -46,6 +48,7 @@ type Deps struct {
|
|||||||
|
|
||||||
// New returns a Server. It does not register any routes; see Mount.
|
// New returns a Server. It does not register any routes; see Mount.
|
||||||
func New(cfg config.API, d Deps) *Server {
|
func New(cfg config.API, d Deps) *Server {
|
||||||
|
allowPrivate := cfg.SSOAllowPrivate()
|
||||||
return &Server{
|
return &Server{
|
||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
log: d.Log,
|
log: d.Log,
|
||||||
@@ -56,6 +59,7 @@ func New(cfg config.API, d Deps) *Server {
|
|||||||
sessions: auth.NewSessions(d.Redis, cfg.SessionIdle, cfg.SessionAbsolute),
|
sessions: auth.NewSessions(d.Redis, cfg.SessionIdle, cfg.SessionAbsolute),
|
||||||
limiter: auth.NewLimiter(d.Redis),
|
limiter: auth.NewLimiter(d.Redis),
|
||||||
totp: auth.NewTOTPVerifier(d.Redis),
|
totp: auth.NewTOTPVerifier(d.Redis),
|
||||||
|
sso: sso.New(sso.SafeHTTPClient(allowPrivate), cfg.PublicURL+"/sso/callback", allowPrivate),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,6 +84,17 @@ func (s *Server) Mount(r gin.IRouter) {
|
|||||||
me.POST("/totp/enable", s.totpEnable)
|
me.POST("/totp/enable", s.totpEnable)
|
||||||
me.POST("/totp/disable", s.totpDisable)
|
me.POST("/totp/disable", s.totpDisable)
|
||||||
|
|
||||||
|
org := v1.Group("/org", auth.Require(), s.requireOwner())
|
||||||
|
org.GET("/sso", s.listSSOProviders)
|
||||||
|
org.POST("/sso", s.createSSOProvider)
|
||||||
|
org.PUT("/sso/:id", s.updateSSOProvider)
|
||||||
|
org.DELETE("/sso/:id", s.deleteSSOProvider)
|
||||||
|
|
||||||
|
g.GET("/sso", s.ssoLookup)
|
||||||
|
g.GET("/sso/callback", s.ssoCallback)
|
||||||
|
g.GET("/sso/:slug", s.ssoChoose)
|
||||||
|
g.GET("/sso/:slug/:provider", s.ssoStartProvider)
|
||||||
|
|
||||||
s.registerPages(g)
|
s.registerPages(g)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,436 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"crypto/sha256"
|
||||||
|
"encoding/hex"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/jackc/pgx/v5"
|
||||||
|
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/auth"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/sso"
|
||||||
|
"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"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
ssoCookie = "__Host-sso"
|
||||||
|
ssoFlowTTL = 10 * time.Minute
|
||||||
|
)
|
||||||
|
|
||||||
|
// ssoFlow is kept in Redis between the redirect to the IdP and the callback.
|
||||||
|
type ssoFlow struct {
|
||||||
|
Provider uuid.UUID `json:"provider"`
|
||||||
|
Org uuid.UUID `json:"org"`
|
||||||
|
Nonce string `json:"nonce"`
|
||||||
|
Verifier string `json:"verifier"`
|
||||||
|
// LinkUser is set when a signed-in user connects this IdP to their
|
||||||
|
// existing account instead of signing in.
|
||||||
|
LinkUser uuid.UUID `json:"link_user,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ssoError aborts a browser flow by redirecting with a code the target page
|
||||||
|
// translates. Unlike JSON errors, the user has navigated away from our page.
|
||||||
|
type ssoError string
|
||||||
|
|
||||||
|
func ssoFlowKey(state string) string {
|
||||||
|
sum := sha256.Sum256([]byte(state))
|
||||||
|
return "sso_flow:" + hex.EncodeToString(sum[:])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) ssoProvider(row store.SsoProvider) (sso.Provider, error) {
|
||||||
|
p := sso.Provider{Issuer: row.Issuer, ClientID: row.ClientID, Scopes: row.Scopes}
|
||||||
|
if row.ClientSecret != nil {
|
||||||
|
secret, err := s.keys.Open(row.ClientSecret, row.ID[:])
|
||||||
|
if err != nil {
|
||||||
|
return p, err
|
||||||
|
}
|
||||||
|
p.ClientSecret = string(secret)
|
||||||
|
}
|
||||||
|
return p, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ssoLookup redirects the login page's slug form to the org's SSO URL.
|
||||||
|
func (s *Server) ssoLookup(c *gin.Context) {
|
||||||
|
slug := strings.ToLower(strings.TrimSpace(c.Query("org")))
|
||||||
|
if slug == "" {
|
||||||
|
c.Redirect(http.StatusSeeOther, "/login")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.Redirect(http.StatusSeeOther, "/sso/"+url.PathEscape(slug))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ssoChoose starts the flow if the org has exactly one enabled provider and
|
||||||
|
// otherwise lets the user pick.
|
||||||
|
func (s *Server) ssoChoose(c *gin.Context) {
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
if !s.limitPage(c, "sso:ip:"+c.ClientIP(), 30, time.Minute) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
org, err := s.orgIDBySlug(ctx, c.Param("slug"))
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var providers []store.ListEnabledSSOProvidersRow
|
||||||
|
if org != uuid.Nil {
|
||||||
|
err = s.db.Tx(ctx, tenant.Org(org, uuid.Nil), func(q *store.Queries) error {
|
||||||
|
providers, err = q.ListEnabledSSOProviders(ctx)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch len(providers) {
|
||||||
|
case 0:
|
||||||
|
s.ssoAbort(c, uuid.Nil, "sso_unavailable")
|
||||||
|
case 1:
|
||||||
|
s.ssoStart(c, org, providers[0].ID)
|
||||||
|
default:
|
||||||
|
opts := make([]web.SSOOption, len(providers))
|
||||||
|
for i, p := range providers {
|
||||||
|
opts[i] = web.SSOOption{Name: p.Name, URL: "/sso/" + url.PathEscape(c.Param("slug")) + "/" + p.ID.String() + linkSuffix(c)}
|
||||||
|
}
|
||||||
|
web.Render(c, http.StatusOK, web.SSOChooser(s.pageFor(c, "sso.choose.title"), opts))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func linkSuffix(c *gin.Context) string {
|
||||||
|
if c.Query("link") == "1" {
|
||||||
|
return "?link=1"
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) ssoStartProvider(c *gin.Context) {
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
if !s.limitPage(c, "sso:ip:"+c.ClientIP(), 30, time.Minute) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
org, err := s.orgIDBySlug(ctx, c.Param("slug"))
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
id, err := uuid.Parse(c.Param("provider"))
|
||||||
|
if err != nil || org == uuid.Nil {
|
||||||
|
s.ssoAbort(c, uuid.Nil, "sso_unavailable")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.ssoStart(c, org, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) ssoStart(c *gin.Context, org, providerID uuid.UUID) {
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
var linkUser uuid.UUID
|
||||||
|
if c.Query("link") == "1" {
|
||||||
|
sess := auth.Current(c)
|
||||||
|
if sess == nil {
|
||||||
|
c.Redirect(http.StatusSeeOther, "/login")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
linkUser = sess.UserID
|
||||||
|
}
|
||||||
|
var row store.SsoProvider
|
||||||
|
err := s.db.Tx(ctx, tenant.Org(org, uuid.Nil), func(q *store.Queries) error {
|
||||||
|
var err error
|
||||||
|
row, err = q.GetSSOProvider(ctx, providerID)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if errors.Is(err, pgx.ErrNoRows) || (err == nil && !row.Enabled) {
|
||||||
|
s.ssoAbort(c, linkUser, "sso_unavailable")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
p, err := s.ssoProvider(row)
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
flow := sso.NewFlow(auth.RandomToken)
|
||||||
|
authURL, err := s.sso.AuthURL(ctx, p, flow)
|
||||||
|
if err != nil {
|
||||||
|
s.log.WarnContext(ctx, "sso discovery failed", "provider", providerID, "error", err)
|
||||||
|
s.ssoAbort(c, linkUser, "sso_provider_error")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
state, _ := json.Marshal(ssoFlow{Provider: row.ID, Org: org, Nonce: flow.Nonce, Verifier: flow.Verifier, LinkUser: linkUser})
|
||||||
|
if err := s.rdb.Set(ctx, ssoFlowKey(flow.State), state, ssoFlowTTL).Err(); err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Binding the state to this browser stops an attacker from completing
|
||||||
|
// their own flow in a victim's browser (login CSRF).
|
||||||
|
setCookie(c, ssoCookie, flow.State, int(ssoFlowTTL.Seconds()))
|
||||||
|
c.Redirect(http.StatusFound, authURL)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) ssoCallback(c *gin.Context) {
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
state := c.Query("state")
|
||||||
|
cookie, _ := c.Cookie(ssoCookie)
|
||||||
|
setCookie(c, ssoCookie, "", -1)
|
||||||
|
if state == "" || cookie != state {
|
||||||
|
s.ssoAbort(c, uuid.Nil, "sso_expired")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
raw, err := s.rdb.GetDel(ctx, ssoFlowKey(state)).Bytes()
|
||||||
|
if err != nil {
|
||||||
|
s.ssoAbort(c, uuid.Nil, "sso_expired")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var f ssoFlow
|
||||||
|
if err := json.Unmarshal(raw, &f); err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if c.Query("error") != "" {
|
||||||
|
s.ssoAbort(c, f.LinkUser, "sso_denied")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var row store.SsoProvider
|
||||||
|
err = s.db.Tx(ctx, tenant.Org(f.Org, uuid.Nil), func(q *store.Queries) error {
|
||||||
|
row, err = q.GetSSOProvider(ctx, f.Provider)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if errors.Is(err, pgx.ErrNoRows) || (err == nil && !row.Enabled) {
|
||||||
|
s.ssoAbort(c, f.LinkUser, "sso_unavailable")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
p, err := s.ssoProvider(row)
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
claims, err := s.sso.Exchange(ctx, p, sso.Flow{State: state, Nonce: f.Nonce, Verifier: f.Verifier}, c.Query("code"))
|
||||||
|
if err != nil {
|
||||||
|
s.log.WarnContext(ctx, "sso exchange failed", "provider", row.ID, "error", err)
|
||||||
|
s.ssoAbort(c, f.LinkUser, "sso_provider_error")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if f.LinkUser != uuid.Nil {
|
||||||
|
s.ssoLink(c, row, f.LinkUser, claims)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
userID, code, err := s.ssoResolveUser(ctx, row, claims)
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if code != "" {
|
||||||
|
s.ssoAbort(c, uuid.Nil, code)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var user store.User
|
||||||
|
err = s.db.Tx(ctx, tenant.Global(), func(q *store.Queries) error {
|
||||||
|
user, err = q.GetUser(ctx, userID)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if user.DisabledAt != nil {
|
||||||
|
s.ssoAbort(c, uuid.Nil, "invalid_credentials")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if old := auth.Current(c); old != nil {
|
||||||
|
_ = s.sessions.Delete(ctx, old)
|
||||||
|
}
|
||||||
|
locale := deref(user.Locale)
|
||||||
|
if locale == "" {
|
||||||
|
locale = i18n.Lang(ctx)
|
||||||
|
}
|
||||||
|
sess, err := s.sessions.Create(ctx, userID, row.OrgID, locale)
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
auth.SetCookie(c, sess, int(s.cfg.SessionAbsolute.Seconds()))
|
||||||
|
c.Redirect(http.StatusSeeOther, "/")
|
||||||
|
}
|
||||||
|
|
||||||
|
// ssoResolveUser maps an IdP identity to a user. It returns a non-empty
|
||||||
|
// error code when sign-in must be refused.
|
||||||
|
//
|
||||||
|
// Existing accounts are only ever reached through a stored identity. A
|
||||||
|
// matching email is not enough: the org controls its IdP and could assert
|
||||||
|
// the address of a user who also belongs to other orgs.
|
||||||
|
func (s *Server) ssoResolveUser(ctx context.Context, row store.SsoProvider, cl sso.Claims) (uuid.UUID, ssoError, error) {
|
||||||
|
var (
|
||||||
|
userID uuid.UUID
|
||||||
|
code ssoError
|
||||||
|
)
|
||||||
|
email := normalizeEmail(cl.Email)
|
||||||
|
err := s.db.Tx(ctx, tenant.Org(row.OrgID, uuid.Nil), func(q *store.Queries) error {
|
||||||
|
ident, err := q.GetIdentity(ctx, store.GetIdentityParams{ProviderID: row.ID, Subject: cl.Subject})
|
||||||
|
switch {
|
||||||
|
case err == nil:
|
||||||
|
member, err := q.IsMember(ctx, store.IsMemberParams{OrgID: row.OrgID, UserID: ident.UserID})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if !member {
|
||||||
|
code = "sso_not_member"
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
userID = ident.UserID
|
||||||
|
return q.TouchIdentity(ctx, store.TouchIdentityParams{ProviderID: row.ID, Subject: cl.Subject, Email: nonEmpty(email)})
|
||||||
|
case !errors.Is(err, pgx.ErrNoRows):
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !row.AutoProvision || email == "" || !cl.EmailVerified || !domainAllowed(email, row.AllowedDomains) {
|
||||||
|
code = "sso_not_provisioned"
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if _, err := q.GetUserByEmail(ctx, email); err == nil {
|
||||||
|
code = "sso_link_required"
|
||||||
|
return nil
|
||||||
|
} else if !errors.Is(err, pgx.ErrNoRows) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
u, err := q.CreateUser(ctx, store.CreateUserParams{
|
||||||
|
Email: email,
|
||||||
|
DisplayName: truncate(strings.TrimSpace(cl.Name), 200),
|
||||||
|
Locale: ptr(i18n.Lang(ctx)),
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := q.AddMembership(ctx, store.AddMembershipParams{OrgID: row.OrgID, UserID: u.ID}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
userID = u.ID
|
||||||
|
return q.CreateIdentity(ctx, store.CreateIdentityParams{ProviderID: row.ID, Subject: cl.Subject, OrgID: row.OrgID, UserID: u.ID, Email: nonEmpty(email)})
|
||||||
|
})
|
||||||
|
return userID, code, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) ssoLink(c *gin.Context, row store.SsoProvider, userID uuid.UUID, cl sso.Claims) {
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
sess := auth.Current(c)
|
||||||
|
if sess == nil || sess.UserID != userID {
|
||||||
|
s.ssoAbort(c, uuid.Nil, "sso_expired")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var code ssoError
|
||||||
|
err := s.db.Tx(ctx, tenant.Org(row.OrgID, userID), func(q *store.Queries) error {
|
||||||
|
member, err := q.IsMember(ctx, store.IsMemberParams{OrgID: row.OrgID, UserID: userID})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if !member {
|
||||||
|
code = "sso_not_member"
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
ident, err := q.GetIdentity(ctx, store.GetIdentityParams{ProviderID: row.ID, Subject: cl.Subject})
|
||||||
|
switch {
|
||||||
|
case err == nil && ident.UserID == userID:
|
||||||
|
return nil
|
||||||
|
case err == nil:
|
||||||
|
code = "sso_identity_taken"
|
||||||
|
return nil
|
||||||
|
case !errors.Is(err, pgx.ErrNoRows):
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return q.CreateIdentity(ctx, store.CreateIdentityParams{
|
||||||
|
ProviderID: row.ID, Subject: cl.Subject, OrgID: row.OrgID, UserID: userID, Email: nonEmpty(normalizeEmail(cl.Email)),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if code != "" {
|
||||||
|
s.ssoAbort(c, userID, code)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.Redirect(http.StatusSeeOther, "/settings/security?sso=linked")
|
||||||
|
}
|
||||||
|
|
||||||
|
// ssoAbort sends the browser back to where the flow started with an error
|
||||||
|
// code the page renders in the user's language.
|
||||||
|
func (s *Server) ssoAbort(c *gin.Context, linkUser uuid.UUID, code ssoError) {
|
||||||
|
target := "/login"
|
||||||
|
if linkUser != uuid.Nil {
|
||||||
|
target = "/settings/security"
|
||||||
|
}
|
||||||
|
c.Redirect(http.StatusSeeOther, target+"?sso_error="+url.QueryEscape(string(code)))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) orgIDBySlug(ctx context.Context, slug string) (uuid.UUID, error) {
|
||||||
|
var id uuid.UUID
|
||||||
|
err := s.db.Tx(ctx, tenant.Global(), func(q *store.Queries) error {
|
||||||
|
var err error
|
||||||
|
id, err = q.OrgIDBySlug(ctx, strings.ToLower(slug))
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
return id, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) limitPage(c *gin.Context, key string, n int, window time.Duration) bool {
|
||||||
|
ok, err := s.limiter.Allow(c.Request.Context(), key, n, window)
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if !ok {
|
||||||
|
c.Header("Retry-After", "60")
|
||||||
|
c.AbortWithStatus(http.StatusTooManyRequests)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func domainAllowed(email string, allowed []string) bool {
|
||||||
|
if len(allowed) == 0 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
at := strings.LastIndexByte(email, '@')
|
||||||
|
if at < 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
domain := email[at+1:]
|
||||||
|
for _, d := range allowed {
|
||||||
|
if domain == d {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func nonEmpty(s string) *string {
|
||||||
|
if s == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &s
|
||||||
|
}
|
||||||
|
|
||||||
|
func truncate(s string, n int) string {
|
||||||
|
if r := []rune(s); len(r) > n {
|
||||||
|
return string(r[:n])
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
@@ -0,0 +1,246 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
"regexp"
|
||||||
|
"slices"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/jackc/pgx/v5"
|
||||||
|
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/auth"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/sso"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/store"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/tenant"
|
||||||
|
)
|
||||||
|
|
||||||
|
const ctxOrgKey = "api.org"
|
||||||
|
|
||||||
|
// requireOwner admits only the owner of the session's active org. It is a
|
||||||
|
// stand-in until role-based permissions exist (#6).
|
||||||
|
func (s *Server) requireOwner() gin.HandlerFunc {
|
||||||
|
return func(c *gin.Context) {
|
||||||
|
sess := auth.Current(c)
|
||||||
|
if sess == nil || sess.OrgID == uuid.Nil {
|
||||||
|
fail(c, http.StatusForbidden, "forbidden")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
var m store.Membership
|
||||||
|
err := s.db.Tx(ctx, tenant.Org(sess.OrgID, sess.UserID), func(q *store.Queries) error {
|
||||||
|
var err error
|
||||||
|
m, err = q.GetMembership(ctx, store.GetMembershipParams{OrgID: sess.OrgID, UserID: sess.UserID})
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if errors.Is(err, pgx.ErrNoRows) || (err == nil && !m.IsOwner) {
|
||||||
|
fail(c, http.StatusForbidden, "forbidden")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.Set(ctxOrgKey, sess.OrgID)
|
||||||
|
c.Next()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func orgOf(c *gin.Context) uuid.UUID { return c.MustGet(ctxOrgKey).(uuid.UUID) }
|
||||||
|
|
||||||
|
type ssoProviderView struct {
|
||||||
|
ID uuid.UUID `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Issuer string `json:"issuer"`
|
||||||
|
ClientID string `json:"client_id"`
|
||||||
|
HasClientSecret bool `json:"has_client_secret"`
|
||||||
|
Scopes []string `json:"scopes"`
|
||||||
|
AllowedDomains []string `json:"allowed_domains"`
|
||||||
|
AutoProvision bool `json:"auto_provision"`
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func viewSSOProvider(p store.SsoProvider) ssoProviderView {
|
||||||
|
return ssoProviderView{
|
||||||
|
ID: p.ID, Name: p.Name, Issuer: p.Issuer, ClientID: p.ClientID,
|
||||||
|
HasClientSecret: p.ClientSecret != nil, Scopes: p.Scopes,
|
||||||
|
AllowedDomains: p.AllowedDomains, AutoProvision: p.AutoProvision, Enabled: p.Enabled,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type ssoProviderRequest struct {
|
||||||
|
Name string `json:"name" binding:"required,max=100"`
|
||||||
|
Issuer string `json:"issuer" binding:"required,max=500"`
|
||||||
|
ClientID string `json:"client_id" binding:"required,max=500"`
|
||||||
|
// Empty on update keeps the stored secret; it is never returned.
|
||||||
|
ClientSecret string `json:"client_secret" binding:"max=2000"`
|
||||||
|
Scopes []string `json:"scopes" binding:"max=20,dive,max=100"`
|
||||||
|
AllowedDomains []string `json:"allowed_domains" binding:"max=50,dive,max=253"`
|
||||||
|
AutoProvision bool `json:"auto_provision"`
|
||||||
|
Enabled *bool `json:"enabled"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var domainRE = regexp.MustCompile(`^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$`)
|
||||||
|
|
||||||
|
// normalize cleans the request and returns an error code for invalid input.
|
||||||
|
func (r *ssoProviderRequest) normalize() string {
|
||||||
|
r.Name = strings.TrimSpace(r.Name)
|
||||||
|
r.Issuer = strings.TrimSuffix(strings.TrimSpace(r.Issuer), "/")
|
||||||
|
r.ClientID = strings.TrimSpace(r.ClientID)
|
||||||
|
if r.Name == "" || r.ClientID == "" {
|
||||||
|
return "invalid_input"
|
||||||
|
}
|
||||||
|
scopes := []string{"openid"}
|
||||||
|
for _, sc := range r.Scopes {
|
||||||
|
if sc = strings.TrimSpace(sc); sc != "" && !slices.Contains(scopes, sc) {
|
||||||
|
scopes = append(scopes, sc)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(r.Scopes) == 0 {
|
||||||
|
scopes = append(scopes, "email", "profile")
|
||||||
|
}
|
||||||
|
r.Scopes = scopes
|
||||||
|
domains := []string{}
|
||||||
|
for _, d := range r.AllowedDomains {
|
||||||
|
d = strings.TrimPrefix(strings.ToLower(strings.TrimSpace(d)), "@")
|
||||||
|
if d == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if !domainRE.MatchString(d) {
|
||||||
|
return "invalid_domain"
|
||||||
|
}
|
||||||
|
if !slices.Contains(domains, d) {
|
||||||
|
domains = append(domains, d)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
r.AllowedDomains = domains
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) listSSOProviders(c *gin.Context) {
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
var rows []store.SsoProvider
|
||||||
|
err := s.db.Tx(ctx, tenant.Org(orgOf(c), auth.Current(c).UserID), func(q *store.Queries) error {
|
||||||
|
var err error
|
||||||
|
rows, err = q.ListSSOProviders(ctx)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
out := make([]ssoProviderView, len(rows))
|
||||||
|
for i, r := range rows {
|
||||||
|
out[i] = viewSSOProvider(r)
|
||||||
|
}
|
||||||
|
c.JSON(http.StatusOK, gin.H{"providers": out, "redirect_url": s.sso.RedirectURL()})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) validateSSORequest(c *gin.Context, req *ssoProviderRequest) bool {
|
||||||
|
if code := req.normalize(); code != "" {
|
||||||
|
fail(c, http.StatusUnprocessableEntity, code)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if err := s.sso.ValidateIssuer(c.Request.Context(), req.Issuer); err != nil {
|
||||||
|
code := "sso_discovery_failed"
|
||||||
|
switch {
|
||||||
|
case errors.Is(err, sso.ErrInvalidIssuer):
|
||||||
|
code = "sso_invalid_issuer"
|
||||||
|
case errors.Is(err, sso.ErrForbiddenAddress):
|
||||||
|
code = "sso_forbidden_address"
|
||||||
|
}
|
||||||
|
fail(c, http.StatusUnprocessableEntity, code)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) createSSOProvider(c *gin.Context) {
|
||||||
|
var req ssoProviderRequest
|
||||||
|
if !bind(c, &req) || !s.validateSSORequest(c, &req) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
id := uuid.New()
|
||||||
|
var secret []byte
|
||||||
|
if req.ClientSecret != "" {
|
||||||
|
secret = s.keys.Seal([]byte(req.ClientSecret), id[:])
|
||||||
|
}
|
||||||
|
var row store.SsoProvider
|
||||||
|
err := s.db.Tx(ctx, tenant.Org(orgOf(c), auth.Current(c).UserID), func(q *store.Queries) error {
|
||||||
|
var err error
|
||||||
|
row, err = q.CreateSSOProvider(ctx, store.CreateSSOProviderParams{
|
||||||
|
ID: id, OrgID: orgOf(c), Name: req.Name, Issuer: req.Issuer, ClientID: req.ClientID,
|
||||||
|
ClientSecret: secret, Scopes: req.Scopes, AllowedDomains: req.AllowedDomains,
|
||||||
|
AutoProvision: req.AutoProvision, Enabled: req.Enabled == nil || *req.Enabled,
|
||||||
|
})
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.JSON(http.StatusCreated, viewSSOProvider(row))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) updateSSOProvider(c *gin.Context) {
|
||||||
|
id, err := uuid.Parse(c.Param("id"))
|
||||||
|
if err != nil {
|
||||||
|
fail(c, http.StatusNotFound, "not_found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var req ssoProviderRequest
|
||||||
|
if !bind(c, &req) || !s.validateSSORequest(c, &req) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
var secret []byte
|
||||||
|
if req.ClientSecret != "" {
|
||||||
|
secret = s.keys.Seal([]byte(req.ClientSecret), id[:])
|
||||||
|
}
|
||||||
|
var row store.SsoProvider
|
||||||
|
err = s.db.Tx(ctx, tenant.Org(orgOf(c), auth.Current(c).UserID), func(q *store.Queries) error {
|
||||||
|
var err error
|
||||||
|
row, err = q.UpdateSSOProvider(ctx, store.UpdateSSOProviderParams{
|
||||||
|
ID: id, Name: req.Name, Issuer: req.Issuer, ClientID: req.ClientID, ClientSecret: secret,
|
||||||
|
Scopes: req.Scopes, AllowedDomains: req.AllowedDomains, AutoProvision: req.AutoProvision,
|
||||||
|
Enabled: req.Enabled == nil || *req.Enabled,
|
||||||
|
})
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if errors.Is(err, pgx.ErrNoRows) {
|
||||||
|
fail(c, http.StatusNotFound, "not_found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.JSON(http.StatusOK, viewSSOProvider(row))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) deleteSSOProvider(c *gin.Context) {
|
||||||
|
id, err := uuid.Parse(c.Param("id"))
|
||||||
|
if err != nil {
|
||||||
|
fail(c, http.StatusNotFound, "not_found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
var n int64
|
||||||
|
err = s.db.Tx(ctx, tenant.Org(orgOf(c), auth.Current(c).UserID), func(q *store.Queries) error {
|
||||||
|
var err error
|
||||||
|
n, err = q.DeleteSSOProvider(ctx, id)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if n == 0 {
|
||||||
|
fail(c, http.StatusNotFound, "not_found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.Status(http.StatusNoContent)
|
||||||
|
}
|
||||||
@@ -0,0 +1,288 @@
|
|||||||
|
package api_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"crypto/rand"
|
||||||
|
"encoding/base64"
|
||||||
|
"encoding/json"
|
||||||
|
"io"
|
||||||
|
"log/slog"
|
||||||
|
"net/http"
|
||||||
|
"net/http/cookiejar"
|
||||||
|
"net/http/httptest"
|
||||||
|
"net/url"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/jackc/pgx/v5/pgxpool"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
|
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/api"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/config"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/migrations"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/platform"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/sealed"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/sso/ssotest"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/tenant"
|
||||||
|
)
|
||||||
|
|
||||||
|
type env struct {
|
||||||
|
srv *httptest.Server
|
||||||
|
dbPool *pgxpool.Pool
|
||||||
|
}
|
||||||
|
|
||||||
|
func newEnv(t *testing.T) *env {
|
||||||
|
t.Helper()
|
||||||
|
dsn, redisURL := os.Getenv("UPTIME_TEST_DATABASE_URL"), os.Getenv("UPTIME_TEST_REDIS_URL")
|
||||||
|
if dsn == "" || redisURL == "" {
|
||||||
|
t.Skip("UPTIME_TEST_DATABASE_URL and UPTIME_TEST_REDIS_URL must be set")
|
||||||
|
}
|
||||||
|
ctx := context.Background()
|
||||||
|
if _, err := migrations.Up(ctx, dsn); err != nil {
|
||||||
|
t.Fatalf("migrations.Up() failed: %v", err)
|
||||||
|
}
|
||||||
|
pool, err := pgxpool.New(ctx, dsn)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Cleanup(pool.Close)
|
||||||
|
opts, err := redis.ParseURL(redisURL)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
rdb := redis.NewClient(opts)
|
||||||
|
t.Cleanup(func() { _ = rdb.Close() })
|
||||||
|
|
||||||
|
key := make([]byte, 32)
|
||||||
|
_, _ = rand.Read(key)
|
||||||
|
keys, err := sealed.Parse("t:" + base64.StdEncoding.EncodeToString(key))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
catalog, err := i18n.Load()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
log := slog.New(slog.DiscardHandler)
|
||||||
|
|
||||||
|
e := &env{dbPool: pool}
|
||||||
|
r := platform.NewRouter(log)
|
||||||
|
e.srv = httptest.NewUnstartedServer(r)
|
||||||
|
e.srv.StartTLS()
|
||||||
|
t.Cleanup(e.srv.Close)
|
||||||
|
|
||||||
|
cfg := config.API{
|
||||||
|
Common: config.Common{Edition: config.EditionSelfHosted},
|
||||||
|
Signup: config.SignupOpen,
|
||||||
|
SessionIdle: time.Hour,
|
||||||
|
SessionAbsolute: 24 * time.Hour,
|
||||||
|
PublicURL: e.srv.URL,
|
||||||
|
SSOPrivateNetworks: "true",
|
||||||
|
}
|
||||||
|
api.New(cfg, api.Deps{Log: log, DB: tenant.New(pool), Redis: rdb, Keys: keys, Catalog: catalog}).Mount(r)
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
|
||||||
|
// browser is a cookie-keeping client that follows redirects like a browser.
|
||||||
|
type browser struct {
|
||||||
|
t *testing.T
|
||||||
|
base string
|
||||||
|
hc *http.Client
|
||||||
|
csrf string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *env) browser(t *testing.T) *browser {
|
||||||
|
jar, _ := cookiejar.New(nil)
|
||||||
|
// Client() returns a shared instance; copy it so each browser has its own jar.
|
||||||
|
hc := *e.srv.Client()
|
||||||
|
hc.Jar = jar
|
||||||
|
return &browser{t: t, base: e.srv.URL, hc: &hc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *browser) do(method, path string, body any) (int, map[string]any) {
|
||||||
|
b.t.Helper()
|
||||||
|
var rd io.Reader
|
||||||
|
if body != nil {
|
||||||
|
raw, _ := json.Marshal(body)
|
||||||
|
rd = bytes.NewReader(raw)
|
||||||
|
}
|
||||||
|
req, _ := http.NewRequest(method, b.base+path, rd)
|
||||||
|
req.Header.Set("Content-Type", "application/json")
|
||||||
|
if b.csrf != "" {
|
||||||
|
req.Header.Set("X-CSRF-Token", b.csrf)
|
||||||
|
}
|
||||||
|
resp, err := b.hc.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
b.t.Fatalf("%s %s failed: %v", method, path, err)
|
||||||
|
}
|
||||||
|
defer func() { _ = resp.Body.Close() }()
|
||||||
|
var out map[string]any
|
||||||
|
_ = json.NewDecoder(resp.Body).Decode(&out)
|
||||||
|
if tok, ok := out["csrf_token"].(string); ok {
|
||||||
|
b.csrf = tok
|
||||||
|
}
|
||||||
|
return resp.StatusCode, out
|
||||||
|
}
|
||||||
|
|
||||||
|
// visit follows redirects and returns the final URL.
|
||||||
|
func (b *browser) visit(path string) *url.URL {
|
||||||
|
b.t.Helper()
|
||||||
|
resp, err := b.hc.Get(b.base + path)
|
||||||
|
if err != nil {
|
||||||
|
b.t.Fatalf("GET %s failed: %v", path, err)
|
||||||
|
}
|
||||||
|
_ = resp.Body.Close()
|
||||||
|
return resp.Request.URL
|
||||||
|
}
|
||||||
|
|
||||||
|
func uniq(prefix string) string { return prefix + strings.ReplaceAll(uuid.NewString()[:8], "-", "") }
|
||||||
|
|
||||||
|
func (b *browser) signup(email, slug string) {
|
||||||
|
b.t.Helper()
|
||||||
|
st, body := b.do("POST", "/api/v1/auth/signup", map[string]any{
|
||||||
|
"email": email, "password": "correct horse battery", "org_name": slug, "org_slug": slug,
|
||||||
|
})
|
||||||
|
if st != http.StatusOK {
|
||||||
|
b.t.Fatalf("signup(%s) = %d %v, want 200", email, st, body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSSO(t *testing.T) {
|
||||||
|
e := newEnv(t)
|
||||||
|
idp := ssotest.New(t)
|
||||||
|
slug := uniq("sso-")
|
||||||
|
domain := uniq("d") + ".test"
|
||||||
|
|
||||||
|
owner := e.browser(t)
|
||||||
|
owner.signup("owner@"+domain, slug)
|
||||||
|
|
||||||
|
st, body := owner.do("POST", "/api/v1/org/sso", map[string]any{
|
||||||
|
"name": "Corp IdP", "issuer": idp.Issuer(), "client_id": idp.ClientID, "client_secret": idp.Secret,
|
||||||
|
"allowed_domains": []string{domain}, "auto_provision": true,
|
||||||
|
})
|
||||||
|
if st != http.StatusCreated {
|
||||||
|
t.Fatalf("create provider = %d %v, want 201", st, body)
|
||||||
|
}
|
||||||
|
if body["has_client_secret"] != true || body["client_secret"] != nil {
|
||||||
|
t.Errorf("create provider response = %v, want has_client_secret and no secret", body)
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Run("other org cannot see provider", func(t *testing.T) {
|
||||||
|
other := e.browser(t)
|
||||||
|
other.signup("x@"+uniq("o")+".test", uniq("other-"))
|
||||||
|
st, body := other.do("GET", "/api/v1/org/sso", nil)
|
||||||
|
if st != http.StatusOK || len(body["providers"].([]any)) != 0 {
|
||||||
|
t.Errorf("GET /api/v1/org/sso as other org = %d %v, want 200 with no providers", st, body)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("auto provisioning", func(t *testing.T) {
|
||||||
|
idp.SetUser(ssotest.User{Subject: uniq("s"), Email: "new@" + domain, EmailVerified: true, Name: "New"})
|
||||||
|
u := e.browser(t)
|
||||||
|
if got := u.visit("/sso/" + slug); got.Path != "/" || got.Query().Get("sso_error") != "" {
|
||||||
|
t.Fatalf("SSO login landed on %s, want /", got)
|
||||||
|
}
|
||||||
|
st, me := u.do("GET", "/api/v1/me", nil)
|
||||||
|
if st != http.StatusOK || me["email"] != "new@"+domain {
|
||||||
|
t.Errorf("GET /api/v1/me = %d %v, want new@%s", st, me, domain)
|
||||||
|
}
|
||||||
|
st, _ = u.do("GET", "/api/v1/org/sso", nil)
|
||||||
|
if st != http.StatusForbidden {
|
||||||
|
t.Errorf("GET /api/v1/org/sso as member = %d, want 403", st)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("unverified email is not provisioned", func(t *testing.T) {
|
||||||
|
idp.SetUser(ssotest.User{Subject: uniq("s"), Email: "unverified@" + domain, EmailVerified: false})
|
||||||
|
if got := e.browser(t).visit("/sso/" + slug); got.Query().Get("sso_error") != "sso_not_provisioned" {
|
||||||
|
t.Errorf("SSO login landed on %s, want sso_error=sso_not_provisioned", got)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("foreign domain is not provisioned", func(t *testing.T) {
|
||||||
|
idp.SetUser(ssotest.User{Subject: uniq("s"), Email: "x@elsewhere.test", EmailVerified: true})
|
||||||
|
if got := e.browser(t).visit("/sso/" + slug); got.Query().Get("sso_error") != "sso_not_provisioned" {
|
||||||
|
t.Errorf("SSO login landed on %s, want sso_error=sso_not_provisioned", got)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("existing email requires explicit linking", func(t *testing.T) {
|
||||||
|
subject := uniq("s")
|
||||||
|
idp.SetUser(ssotest.User{Subject: subject, Email: "owner@" + domain, EmailVerified: true})
|
||||||
|
if got := e.browser(t).visit("/sso/" + slug); got.Query().Get("sso_error") != "sso_link_required" {
|
||||||
|
t.Fatalf("SSO login landed on %s, want sso_error=sso_link_required", got)
|
||||||
|
}
|
||||||
|
|
||||||
|
if got := owner.visit("/sso/" + slug + "?link=1"); got.Path != "/settings/security" || got.Query().Get("sso") != "linked" {
|
||||||
|
t.Fatalf("link flow landed on %s, want /settings/security?sso=linked", got)
|
||||||
|
}
|
||||||
|
fresh := e.browser(t)
|
||||||
|
if got := fresh.visit("/sso/" + slug); got.Path != "/" {
|
||||||
|
t.Fatalf("SSO login after linking landed on %s, want /", got)
|
||||||
|
}
|
||||||
|
if _, me := fresh.do("GET", "/api/v1/me", nil); me["email"] != "owner@"+domain {
|
||||||
|
t.Errorf("GET /api/v1/me after linked login = %v, want owner", me)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("callback without browser binding is rejected", func(t *testing.T) {
|
||||||
|
attacker := e.browser(t)
|
||||||
|
attacker.hc.CheckRedirect = func(req *http.Request, _ []*http.Request) error {
|
||||||
|
if strings.HasPrefix(req.URL.Path, "/sso/callback") {
|
||||||
|
return http.ErrUseLastResponse
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
resp, err := attacker.hc.Get(attacker.base + "/sso/" + slug)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
_ = resp.Body.Close()
|
||||||
|
callback := resp.Header.Get("Location")
|
||||||
|
if got := e.browser(t).visit(strings.TrimPrefix(callback, attacker.base)); got.Query().Get("sso_error") != "sso_expired" {
|
||||||
|
t.Errorf("replaying callback in another browser landed on %s, want sso_error=sso_expired", got)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("disabled provider", func(t *testing.T) {
|
||||||
|
_, list := owner.do("GET", "/api/v1/org/sso", nil)
|
||||||
|
p := list["providers"].([]any)[0].(map[string]any)
|
||||||
|
st, body := owner.do("PUT", "/api/v1/org/sso/"+p["id"].(string), map[string]any{
|
||||||
|
"name": p["name"], "issuer": p["issuer"], "client_id": p["client_id"], "enabled": false,
|
||||||
|
})
|
||||||
|
if st != http.StatusOK || body["has_client_secret"] != true {
|
||||||
|
t.Fatalf("PUT provider = %d %v, want 200 keeping the secret", st, body)
|
||||||
|
}
|
||||||
|
if got := e.browser(t).visit("/sso/" + slug); got.Query().Get("sso_error") != "sso_unavailable" {
|
||||||
|
t.Errorf("SSO login with disabled provider landed on %s, want sso_error=sso_unavailable", got)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSSOProviderValidation(t *testing.T) {
|
||||||
|
e := newEnv(t)
|
||||||
|
owner := e.browser(t)
|
||||||
|
owner.signup("o@"+uniq("v")+".test", uniq("val-"))
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
body map[string]any
|
||||||
|
want string
|
||||||
|
}{
|
||||||
|
{"bad scheme", map[string]any{"name": "x", "issuer": "ftp://idp.test", "client_id": "c"}, "sso_invalid_issuer"},
|
||||||
|
{"unreachable", map[string]any{"name": "x", "issuer": "http://127.0.0.1:1", "client_id": "c"}, "sso_discovery_failed"},
|
||||||
|
{"bad domain", map[string]any{"name": "x", "issuer": "https://idp.test", "client_id": "c", "allowed_domains": []string{"not a domain"}}, "invalid_domain"},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
st, body := owner.do("POST", "/api/v1/org/sso", tt.body)
|
||||||
|
if st != http.StatusUnprocessableEntity || body["error"] != tt.want {
|
||||||
|
t.Errorf("POST /api/v1/org/sso = %d %v, want 422 %s", st, body["error"], tt.want)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,8 @@ package config
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/caarlos0/env/v11"
|
"github.com/caarlos0/env/v11"
|
||||||
@@ -61,6 +63,22 @@ type API struct {
|
|||||||
Signup SignupMode `env:"UPTIME_SIGNUP" envDefault:"first-user"`
|
Signup SignupMode `env:"UPTIME_SIGNUP" envDefault:"first-user"`
|
||||||
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 string `env:"UPTIME_PUBLIC_URL" envDefault:"http://localhost:8080"`
|
||||||
|
// SSOPrivateNetworks is "auto", "true" or "false". Auto allows
|
||||||
|
// organizations' IdPs on private networks only in the self-hosted edition.
|
||||||
|
SSOPrivateNetworks string `env:"UPTIME_SSO_ALLOW_PRIVATE_NETWORKS" envDefault:"auto"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SSOAllowPrivate resolves SSOPrivateNetworks.
|
||||||
|
func (a API) SSOAllowPrivate() bool {
|
||||||
|
switch a.SSOPrivateNetworks {
|
||||||
|
case "true":
|
||||||
|
return true
|
||||||
|
case "false":
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return a.Edition == EditionSelfHosted
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate checks API-specific settings in addition to Common.Validate.
|
// Validate checks API-specific settings in addition to Common.Validate.
|
||||||
@@ -76,6 +94,14 @@ 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.SSOPrivateNetworks {
|
||||||
|
case "auto", "true", "false":
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("config: UPTIME_SSO_ALLOW_PRIVATE_NETWORKS must be auto, true or false")
|
||||||
|
}
|
||||||
|
if u, err := url.Parse(a.PublicURL); err != nil || u.Host == "" || (u.Scheme != "https" && u.Scheme != "http") || strings.HasSuffix(a.PublicURL, "/") {
|
||||||
|
return fmt.Errorf("config: UPTIME_PUBLIC_URL must be an absolute http(s) URL without trailing slash")
|
||||||
|
}
|
||||||
if a.SessionIdle <= 0 || a.SessionAbsolute < a.SessionIdle {
|
if a.SessionIdle <= 0 || a.SessionAbsolute < a.SessionIdle {
|
||||||
return fmt.Errorf("config: UPTIME_SESSION_ABSOLUTE must be >= UPTIME_SESSION_IDLE > 0")
|
return fmt.Errorf("config: UPTIME_SESSION_ABSOLUTE must be >= UPTIME_SESSION_IDLE > 0")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ var usagePatterns = []struct {
|
|||||||
{regexp.MustCompile(`i18n\.T\(ctx, "([a-z0-9_.]+)"[,)]`), ""},
|
{regexp.MustCompile(`i18n\.T\(ctx, "([a-z0-9_.]+)"[,)]`), ""},
|
||||||
{regexp.MustCompile(`\bfail\(c, [^,]+, "([a-z_]+)"`), "error."},
|
{regexp.MustCompile(`\bfail\(c, [^,]+, "([a-z_]+)"`), "error."},
|
||||||
{regexp.MustCompile(`\b(?:pageFor\(c|s\.page\()(?:, )?"([a-z0-9_.]+)"`), ""},
|
{regexp.MustCompile(`\b(?:pageFor\(c|s\.page\()(?:, )?"([a-z0-9_.]+)"`), ""},
|
||||||
|
{regexp.MustCompile(`[^(]"(sso_[a-z_]+)"`), "error."},
|
||||||
|
{regexp.MustCompile(`return "(invalid_[a-z_]+)"`), "error."},
|
||||||
|
{regexp.MustCompile(`NoticeID = "([a-z0-9_.]+)"`), ""},
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestUsedKeysExist scans the source tree for literal message IDs so a typo
|
// TestUsedKeysExist scans the source tree for literal message IDs so a typo
|
||||||
|
|||||||
@@ -1,57 +1,96 @@
|
|||||||
{
|
{
|
||||||
"app.network_error": "Verbindung fehlgeschlagen.",
|
"app.network_error": "Verbindung fehlgeschlagen.",
|
||||||
"lang.en": "English",
|
"auth.field.code": "Code",
|
||||||
"lang.de": "Deutsch",
|
|
||||||
|
|
||||||
"auth.login.title": "Anmelden",
|
|
||||||
"auth.login.totp_hint": "Code aus der Authenticator-App eingeben.",
|
|
||||||
"auth.login.submit": "Weiter",
|
|
||||||
"auth.login.no_account": "Noch kein Konto?",
|
|
||||||
"auth.login.to_signup": "Registrieren",
|
|
||||||
"auth.signup.title": "Konto anlegen",
|
|
||||||
"auth.signup.submit": "Anlegen",
|
|
||||||
"auth.signup.to_login": "Zur Anmeldung",
|
|
||||||
"auth.field.name": "Name",
|
|
||||||
"auth.field.email": "E-Mail",
|
"auth.field.email": "E-Mail",
|
||||||
"auth.field.password": "Passwort",
|
"auth.field.name": "Name",
|
||||||
"auth.field.new_password": "Passwort (min. {{.Min}} Zeichen)",
|
"auth.field.new_password": "Passwort (min. {{.Min}} Zeichen)",
|
||||||
"auth.field.org_name": "Organisation",
|
"auth.field.org_name": "Organisation",
|
||||||
"auth.field.org_slug": "Kurzname (a–z, 0–9, -)",
|
"auth.field.org_slug": "Kurzname (a–z, 0–9, -)",
|
||||||
"auth.field.code": "Code",
|
"auth.field.password": "Passwort",
|
||||||
|
"auth.login.no_account": "Noch kein Konto?",
|
||||||
"console.nav.security": "Sicherheit",
|
"auth.login.submit": "Weiter",
|
||||||
|
"auth.login.title": "Anmelden",
|
||||||
|
"auth.login.to_signup": "Registrieren",
|
||||||
|
"auth.login.totp_hint": "Code aus der Authenticator-App eingeben.",
|
||||||
|
"auth.signup.submit": "Anlegen",
|
||||||
|
"auth.signup.title": "Konto anlegen",
|
||||||
|
"auth.signup.to_login": "Zur Anmeldung",
|
||||||
|
"auth.sso.heading": "Single Sign-on",
|
||||||
|
"auth.sso.org_placeholder": "Kurzname der Organisation",
|
||||||
|
"auth.sso.submit": "Weiter",
|
||||||
|
"common.no": "nein",
|
||||||
|
"common.save": "Speichern",
|
||||||
|
"common.yes": "ja",
|
||||||
|
"console.monitors.empty": "Noch keine Monitore angelegt.",
|
||||||
|
"console.monitors.title": "Monitore",
|
||||||
"console.nav.logout": "Abmelden",
|
"console.nav.logout": "Abmelden",
|
||||||
|
"console.nav.security": "Sicherheit",
|
||||||
|
"console.nav.sso": "SSO",
|
||||||
"console.totp_missing": "Deine Organisation verlangt Zwei-Faktor-Anmeldung.",
|
"console.totp_missing": "Deine Organisation verlangt Zwei-Faktor-Anmeldung.",
|
||||||
"console.totp_missing_action": "Jetzt einrichten",
|
"console.totp_missing_action": "Jetzt einrichten",
|
||||||
"console.monitors.title": "Monitore",
|
"error.email_taken": "Diese E-Mail-Adresse ist bereits registriert.",
|
||||||
"console.monitors.empty": "Noch keine Monitore angelegt.",
|
"error.forbidden": "Dafür fehlt dir die Berechtigung.",
|
||||||
|
|
||||||
"security.title": "Sicherheit",
|
|
||||||
"security.totp.heading": "Zwei-Faktor (TOTP)",
|
|
||||||
"security.totp.active": "aktiv",
|
|
||||||
"security.totp.inactive": "nicht eingerichtet",
|
|
||||||
"security.totp.disable": "Deaktivieren",
|
|
||||||
"security.totp.current_code": "Aktueller Code",
|
|
||||||
"security.totp.start": "Einrichten",
|
|
||||||
"security.totp.qr_alt": "QR-Code für die Authenticator-App",
|
|
||||||
"security.totp.app_code": "Code aus der App",
|
|
||||||
"security.totp.confirm": "Bestätigen",
|
|
||||||
|
|
||||||
"error.internal": "Interner Fehler.",
|
"error.internal": "Interner Fehler.",
|
||||||
|
"error.invalid_code": "Code ungültig.",
|
||||||
|
"error.invalid_credentials": "E-Mail oder Passwort falsch.",
|
||||||
|
"error.invalid_domain": "Eine der Domains ist ungültig.",
|
||||||
"error.invalid_input": "Eingaben prüfen.",
|
"error.invalid_input": "Eingaben prüfen.",
|
||||||
|
"error.invalid_slug": "Kurzname: 2–63 Zeichen, a–z, 0–9 und Bindestrich.",
|
||||||
|
"error.mfa_expired": "Anmeldung abgelaufen, bitte erneut anmelden.",
|
||||||
|
"error.no_password": "Konto ohne Passwort.",
|
||||||
|
"error.not_found": "Nicht gefunden.",
|
||||||
|
"error.org_not_found": "Organisation nicht gefunden.",
|
||||||
|
"error.password_too_short": "Das Passwort braucht mindestens {{.Min}} Zeichen.",
|
||||||
"error.rate_limited": "Zu viele Versuche, bitte später erneut.",
|
"error.rate_limited": "Zu viele Versuche, bitte später erneut.",
|
||||||
"error.signup_closed": "Registrierung ist deaktiviert.",
|
"error.signup_closed": "Registrierung ist deaktiviert.",
|
||||||
"error.password_too_short": "Das Passwort braucht mindestens {{.Min}} Zeichen.",
|
|
||||||
"error.email_taken": "Diese E-Mail-Adresse ist bereits registriert.",
|
|
||||||
"error.slug_taken": "Dieser Kurzname ist bereits vergeben.",
|
"error.slug_taken": "Dieser Kurzname ist bereits vergeben.",
|
||||||
"error.invalid_slug": "Kurzname: 2–63 Zeichen, a–z, 0–9 und Bindestrich.",
|
"error.sso_denied": "Die Anmeldung wurde beim Identity Provider abgebrochen.",
|
||||||
"error.invalid_credentials": "E-Mail oder Passwort falsch.",
|
"error.sso_discovery_failed": "Der Identity Provider ist nicht erreichbar oder lieferte keine gültige Konfiguration.",
|
||||||
"error.mfa_expired": "Anmeldung abgelaufen, bitte erneut anmelden.",
|
"error.sso_expired": "Der Anmeldeversuch ist abgelaufen, bitte neu starten.",
|
||||||
"error.invalid_code": "Code ungültig.",
|
"error.sso_forbidden_address": "Der Issuer zeigt auf eine nicht öffentliche Adresse.",
|
||||||
"error.org_not_found": "Organisation nicht gefunden.",
|
"error.sso_identity_taken": "Diese SSO-Anmeldung ist bereits mit einem anderen Konto verknüpft.",
|
||||||
|
"error.sso_invalid_issuer": "Der Issuer muss eine https-URL ohne Query und Zugangsdaten sein.",
|
||||||
|
"error.sso_link_required": "Es gibt bereits ein Konto mit dieser E-Mail. Melde dich mit Passwort an und verknüpfe SSO unter Sicherheit.",
|
||||||
|
"error.sso_not_member": "Dein Konto ist kein Mitglied dieser Organisation.",
|
||||||
|
"error.sso_not_provisioned": "Für diese Anmeldung gibt es kein Konto. Bitte lass dich von einem Admin einladen.",
|
||||||
|
"error.sso_provider_error": "Der Identity Provider konnte die Anmeldung nicht abschließen.",
|
||||||
|
"error.sso_unavailable": "Für diese Organisation ist kein Single Sign-on verfügbar.",
|
||||||
"error.totp_already_enabled": "TOTP ist bereits aktiv.",
|
"error.totp_already_enabled": "TOTP ist bereits aktiv.",
|
||||||
"error.totp_setup_expired": "Einrichtung abgelaufen, bitte neu starten.",
|
|
||||||
"error.totp_required_by_org": "Eine deiner Organisationen verlangt TOTP.",
|
"error.totp_required_by_org": "Eine deiner Organisationen verlangt TOTP.",
|
||||||
"error.no_password": "Konto ohne Passwort.",
|
"error.totp_setup_expired": "Einrichtung abgelaufen, bitte neu starten.",
|
||||||
"error.unsupported_locale": "Sprache wird nicht unterstützt."
|
"error.unsupported_locale": "Sprache wird nicht unterstützt.",
|
||||||
|
"lang.de": "Deutsch",
|
||||||
|
"lang.en": "English",
|
||||||
|
"security.sso.heading": "Single Sign-on",
|
||||||
|
"security.sso.link": "SSO-Anmeldung verknüpfen",
|
||||||
|
"security.sso.linked": "SSO-Anmeldung verknüpft.",
|
||||||
|
"security.sso.none": "In dieser Organisation ist keine SSO-Anmeldung verknüpft.",
|
||||||
|
"security.title": "Sicherheit",
|
||||||
|
"security.totp.active": "aktiv",
|
||||||
|
"security.totp.app_code": "Code aus der App",
|
||||||
|
"security.totp.confirm": "Bestätigen",
|
||||||
|
"security.totp.current_code": "Aktueller Code",
|
||||||
|
"security.totp.disable": "Deaktivieren",
|
||||||
|
"security.totp.heading": "Zwei-Faktor (TOTP)",
|
||||||
|
"security.totp.inactive": "nicht eingerichtet",
|
||||||
|
"security.totp.qr_alt": "QR-Code für die Authenticator-App",
|
||||||
|
"security.totp.start": "Einrichten",
|
||||||
|
"sso.action.delete": "Provider löschen",
|
||||||
|
"sso.action.delete_confirm": "Diesen Provider löschen? Verknüpfte Anmeldungen funktionieren dann nicht mehr.",
|
||||||
|
"sso.action.edit": "Bearbeiten",
|
||||||
|
"sso.choose.title": "Anmeldung wählen",
|
||||||
|
"sso.field.allowed_domains": "Erlaubte E-Mail-Domains",
|
||||||
|
"sso.field.allowed_domains_hint": "Kommagetrennt. Gilt nur für automatisch angelegte Konten; leer erlaubt jede Domain.",
|
||||||
|
"sso.field.auto_provision": "Konten automatisch anlegen",
|
||||||
|
"sso.field.client_id": "Client-ID",
|
||||||
|
"sso.field.client_secret": "Client-Secret",
|
||||||
|
"sso.field.client_secret_keep": "unverändert",
|
||||||
|
"sso.field.enabled": "Aktiv",
|
||||||
|
"sso.field.issuer": "Issuer-URL",
|
||||||
|
"sso.field.name": "Name",
|
||||||
|
"sso.settings.add": "Provider hinzufügen",
|
||||||
|
"sso.settings.intro": "Mitglieder dieser Organisation können sich über euren eigenen OpenID-Connect-Identity-Provider anmelden. Tragt die Redirect-URL unten bei eurem Provider als erlaubten Callback ein.",
|
||||||
|
"sso.settings.login_url": "Anmelde-URL",
|
||||||
|
"sso.settings.redirect_url": "Redirect-URL",
|
||||||
|
"sso.settings.title": "Single Sign-on"
|
||||||
}
|
}
|
||||||
@@ -1,57 +1,96 @@
|
|||||||
{
|
{
|
||||||
"app.network_error": "Connection failed.",
|
"app.network_error": "Connection failed.",
|
||||||
"lang.en": "English",
|
"auth.field.code": "Code",
|
||||||
"lang.de": "Deutsch",
|
|
||||||
|
|
||||||
"auth.login.title": "Sign in",
|
|
||||||
"auth.login.totp_hint": "Enter the code from your authenticator app.",
|
|
||||||
"auth.login.submit": "Continue",
|
|
||||||
"auth.login.no_account": "No account yet?",
|
|
||||||
"auth.login.to_signup": "Sign up",
|
|
||||||
"auth.signup.title": "Create account",
|
|
||||||
"auth.signup.submit": "Create",
|
|
||||||
"auth.signup.to_login": "Back to sign in",
|
|
||||||
"auth.field.name": "Name",
|
|
||||||
"auth.field.email": "Email",
|
"auth.field.email": "Email",
|
||||||
"auth.field.password": "Password",
|
"auth.field.name": "Name",
|
||||||
"auth.field.new_password": "Password (min. {{.Min}} characters)",
|
"auth.field.new_password": "Password (min. {{.Min}} characters)",
|
||||||
"auth.field.org_name": "Organization",
|
"auth.field.org_name": "Organization",
|
||||||
"auth.field.org_slug": "Short name (a–z, 0–9, -)",
|
"auth.field.org_slug": "Short name (a–z, 0–9, -)",
|
||||||
"auth.field.code": "Code",
|
"auth.field.password": "Password",
|
||||||
|
"auth.login.no_account": "No account yet?",
|
||||||
"console.nav.security": "Security",
|
"auth.login.submit": "Continue",
|
||||||
|
"auth.login.title": "Sign in",
|
||||||
|
"auth.login.to_signup": "Sign up",
|
||||||
|
"auth.login.totp_hint": "Enter the code from your authenticator app.",
|
||||||
|
"auth.signup.submit": "Create",
|
||||||
|
"auth.signup.title": "Create account",
|
||||||
|
"auth.signup.to_login": "Back to sign in",
|
||||||
|
"auth.sso.heading": "Single sign-on",
|
||||||
|
"auth.sso.org_placeholder": "Organization short name",
|
||||||
|
"auth.sso.submit": "Continue",
|
||||||
|
"common.no": "no",
|
||||||
|
"common.save": "Save",
|
||||||
|
"common.yes": "yes",
|
||||||
|
"console.monitors.empty": "No monitors yet.",
|
||||||
|
"console.monitors.title": "Monitors",
|
||||||
"console.nav.logout": "Sign out",
|
"console.nav.logout": "Sign out",
|
||||||
|
"console.nav.security": "Security",
|
||||||
|
"console.nav.sso": "SSO",
|
||||||
"console.totp_missing": "Your organization requires two-factor sign-in.",
|
"console.totp_missing": "Your organization requires two-factor sign-in.",
|
||||||
"console.totp_missing_action": "Set up now",
|
"console.totp_missing_action": "Set up now",
|
||||||
"console.monitors.title": "Monitors",
|
"error.email_taken": "This email address is already registered.",
|
||||||
"console.monitors.empty": "No monitors yet.",
|
"error.forbidden": "You are not allowed to do this.",
|
||||||
|
|
||||||
"security.title": "Security",
|
|
||||||
"security.totp.heading": "Two-factor (TOTP)",
|
|
||||||
"security.totp.active": "active",
|
|
||||||
"security.totp.inactive": "not set up",
|
|
||||||
"security.totp.disable": "Disable",
|
|
||||||
"security.totp.current_code": "Current code",
|
|
||||||
"security.totp.start": "Set up",
|
|
||||||
"security.totp.qr_alt": "QR code for your authenticator app",
|
|
||||||
"security.totp.app_code": "Code from the app",
|
|
||||||
"security.totp.confirm": "Confirm",
|
|
||||||
|
|
||||||
"error.internal": "Internal error.",
|
"error.internal": "Internal error.",
|
||||||
|
"error.invalid_code": "Invalid code.",
|
||||||
|
"error.invalid_credentials": "Wrong email or password.",
|
||||||
|
"error.invalid_domain": "One of the domains is not valid.",
|
||||||
"error.invalid_input": "Please check your input.",
|
"error.invalid_input": "Please check your input.",
|
||||||
|
"error.invalid_slug": "Short name: 2–63 characters, a–z, 0–9 and hyphen.",
|
||||||
|
"error.mfa_expired": "Sign-in expired, please start again.",
|
||||||
|
"error.no_password": "This account has no password.",
|
||||||
|
"error.not_found": "Not found.",
|
||||||
|
"error.org_not_found": "Organization not found.",
|
||||||
|
"error.password_too_short": "The password needs at least {{.Min}} characters.",
|
||||||
"error.rate_limited": "Too many attempts, please try again later.",
|
"error.rate_limited": "Too many attempts, please try again later.",
|
||||||
"error.signup_closed": "Sign-up is disabled.",
|
"error.signup_closed": "Sign-up is disabled.",
|
||||||
"error.password_too_short": "The password needs at least {{.Min}} characters.",
|
|
||||||
"error.email_taken": "This email address is already registered.",
|
|
||||||
"error.slug_taken": "This short name is already taken.",
|
"error.slug_taken": "This short name is already taken.",
|
||||||
"error.invalid_slug": "Short name: 2–63 characters, a–z, 0–9 and hyphen.",
|
"error.sso_denied": "Sign-in was cancelled at the identity provider.",
|
||||||
"error.invalid_credentials": "Wrong email or password.",
|
"error.sso_discovery_failed": "The identity provider could not be reached or returned no valid configuration.",
|
||||||
"error.mfa_expired": "Sign-in expired, please start again.",
|
"error.sso_expired": "The sign-in attempt expired, please start again.",
|
||||||
"error.invalid_code": "Invalid code.",
|
"error.sso_forbidden_address": "The issuer points to a non-public address.",
|
||||||
"error.org_not_found": "Organization not found.",
|
"error.sso_identity_taken": "This SSO sign-in is already linked to another account.",
|
||||||
|
"error.sso_invalid_issuer": "The issuer must be an https URL without query or credentials.",
|
||||||
|
"error.sso_link_required": "An account with this email already exists. Sign in with your password and link SSO under Security.",
|
||||||
|
"error.sso_not_member": "Your account is not a member of this organization.",
|
||||||
|
"error.sso_not_provisioned": "No account exists for this sign-in. Ask an administrator to invite you.",
|
||||||
|
"error.sso_provider_error": "The identity provider could not complete the sign-in.",
|
||||||
|
"error.sso_unavailable": "Single sign-on is not available for this organization.",
|
||||||
"error.totp_already_enabled": "TOTP is already active.",
|
"error.totp_already_enabled": "TOTP is already active.",
|
||||||
"error.totp_setup_expired": "Setup expired, please start again.",
|
|
||||||
"error.totp_required_by_org": "One of your organizations requires TOTP.",
|
"error.totp_required_by_org": "One of your organizations requires TOTP.",
|
||||||
"error.no_password": "This account has no password.",
|
"error.totp_setup_expired": "Setup expired, please start again.",
|
||||||
"error.unsupported_locale": "Unsupported language."
|
"error.unsupported_locale": "Unsupported language.",
|
||||||
|
"lang.de": "Deutsch",
|
||||||
|
"lang.en": "English",
|
||||||
|
"security.sso.heading": "Single sign-on",
|
||||||
|
"security.sso.link": "Link SSO sign-in",
|
||||||
|
"security.sso.linked": "SSO sign-in linked.",
|
||||||
|
"security.sso.none": "No SSO sign-in linked in this organization.",
|
||||||
|
"security.title": "Security",
|
||||||
|
"security.totp.active": "active",
|
||||||
|
"security.totp.app_code": "Code from the app",
|
||||||
|
"security.totp.confirm": "Confirm",
|
||||||
|
"security.totp.current_code": "Current code",
|
||||||
|
"security.totp.disable": "Disable",
|
||||||
|
"security.totp.heading": "Two-factor (TOTP)",
|
||||||
|
"security.totp.inactive": "not set up",
|
||||||
|
"security.totp.qr_alt": "QR code for your authenticator app",
|
||||||
|
"security.totp.start": "Set up",
|
||||||
|
"sso.action.delete": "Delete provider",
|
||||||
|
"sso.action.delete_confirm": "Delete this provider? Linked sign-ins stop working.",
|
||||||
|
"sso.action.edit": "Edit",
|
||||||
|
"sso.choose.title": "Choose sign-in",
|
||||||
|
"sso.field.allowed_domains": "Allowed email domains",
|
||||||
|
"sso.field.allowed_domains_hint": "Comma-separated. Only applies to automatically created accounts; empty allows any domain.",
|
||||||
|
"sso.field.auto_provision": "Create accounts automatically",
|
||||||
|
"sso.field.client_id": "Client ID",
|
||||||
|
"sso.field.client_secret": "Client secret",
|
||||||
|
"sso.field.client_secret_keep": "unchanged",
|
||||||
|
"sso.field.enabled": "Enabled",
|
||||||
|
"sso.field.issuer": "Issuer URL",
|
||||||
|
"sso.field.name": "Name",
|
||||||
|
"sso.settings.add": "Add provider",
|
||||||
|
"sso.settings.intro": "Members of this organization can sign in through your own OpenID Connect identity provider. Register the redirect URL below as an allowed callback at your provider.",
|
||||||
|
"sso.settings.login_url": "Sign-in URL",
|
||||||
|
"sso.settings.redirect_url": "Redirect URL",
|
||||||
|
"sso.settings.title": "Single sign-on"
|
||||||
}
|
}
|
||||||
@@ -17,24 +17,33 @@
|
|||||||
el.classList.toggle("hidden", !text);
|
el.classList.toggle("hidden", !text);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Inputs inside a hidden [data-step] are skipped, checkboxes become
|
||||||
|
// booleans and [data-list] inputs become comma-separated arrays.
|
||||||
|
const serialize = (form) => {
|
||||||
|
const out = {};
|
||||||
|
for (const el of form.elements) {
|
||||||
|
if (!el.name || el.disabled || el.closest("[data-step]")?.hidden) continue;
|
||||||
|
if (el.type === "checkbox") out[el.name] = el.checked;
|
||||||
|
else if (el.dataset.list !== undefined)
|
||||||
|
out[el.name] = el.value.split(",").map((v) => v.trim()).filter(Boolean);
|
||||||
|
else out[el.name] = el.value;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
};
|
||||||
|
|
||||||
document.addEventListener("submit", async (ev) => {
|
document.addEventListener("submit", async (ev) => {
|
||||||
const form = ev.target.closest("form[data-api]");
|
const form = ev.target.closest("form[data-api]");
|
||||||
if (!form) return;
|
if (!form) return;
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
const button = form.querySelector("button[type=submit]");
|
const button = form.querySelector("button[type=submit]");
|
||||||
const body = Object.fromEntries(
|
const body = serialize(form);
|
||||||
[...new FormData(form)].filter(([k]) => {
|
|
||||||
const step = form.querySelector(`[name="${k}"]`)?.closest("[data-step]");
|
|
||||||
return !step || !step.hidden;
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
const totpStep = form.querySelector('[data-step="totp"]');
|
const totpStep = form.querySelector('[data-step="totp"]');
|
||||||
const url = totpStep && !totpStep.hidden ? `${form.dataset.api}/totp` : form.dataset.api;
|
const url = totpStep && !totpStep.hidden ? `${form.dataset.api}/totp` : form.dataset.api;
|
||||||
|
|
||||||
showError(form, "");
|
showError(form, "");
|
||||||
button && (button.disabled = true);
|
button && (button.disabled = true);
|
||||||
try {
|
try {
|
||||||
const res = await api.post(url, body);
|
const res = await api.request({ method: form.dataset.method || "post", url, data: body });
|
||||||
if (res.data?.status === "totp_required" && totpStep) {
|
if (res.data?.status === "totp_required" && totpStep) {
|
||||||
form.querySelector('[data-step="password"]').hidden = true;
|
form.querySelector('[data-step="password"]').hidden = true;
|
||||||
totpStep.hidden = false;
|
totpStep.hidden = false;
|
||||||
@@ -56,6 +65,17 @@
|
|||||||
location.reload();
|
location.reload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const del = ev.target.closest("[data-delete]");
|
||||||
|
if (del) {
|
||||||
|
if (del.dataset.confirm && !confirm(del.dataset.confirm)) return;
|
||||||
|
try {
|
||||||
|
await api.delete(del.dataset.delete);
|
||||||
|
location.reload();
|
||||||
|
} catch (err) {
|
||||||
|
alert(message(err));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (ev.target.closest("[data-logout]")) {
|
if (ev.target.closest("[data-logout]")) {
|
||||||
await api.post("/auth/logout").catch(() => {});
|
await api.post("/auth/logout").catch(() => {});
|
||||||
location.assign("/login");
|
location.assign("/login");
|
||||||
|
|||||||
@@ -19,6 +19,20 @@ templ Login(p Page, signupAllowed bool) {
|
|||||||
</div>
|
</div>
|
||||||
@submit(i18n.T(ctx, "auth.login.submit"))
|
@submit(i18n.T(ctx, "auth.login.submit"))
|
||||||
</form>
|
</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">{ i18n.T(ctx, "auth.sso.heading") }</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={ i18n.T(ctx, "auth.sso.org_placeholder") }
|
||||||
|
aria-label={ i18n.T(ctx, "auth.sso.org_placeholder") }
|
||||||
|
autocomplete="organization"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<button type="submit" class="border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper">{ i18n.T(ctx, "auth.sso.submit") }</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
if signupAllowed {
|
if signupAllowed {
|
||||||
<p class="mt-8 text-sm text-muted">
|
<p class="mt-8 text-sm text-muted">
|
||||||
{ i18n.T(ctx, "auth.login.no_account") }
|
{ i18n.T(ctx, "auth.login.no_account") }
|
||||||
|
|||||||
+74
-22
@@ -92,38 +92,90 @@ func Login(p Page, signupAllowed bool) 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, 6, "</form>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</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\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var4 string
|
||||||
|
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.sso.heading"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 23, Col: 108}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</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 {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var5 string
|
||||||
|
templ_7745c5c3_Var5, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "auth.sso.org_placeholder")).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 28, Col: 58}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var5)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "\" aria-label=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var6 string
|
||||||
|
templ_7745c5c3_Var6, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "auth.sso.org_placeholder")).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 29, Col: 57}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "\" 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_Var7 string
|
||||||
|
templ_7745c5c3_Var7, 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: 33, Col: 134}
|
||||||
|
}
|
||||||
|
_, 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, 10, "</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, 7, "<p class=\"mt-8 text-sm text-muted\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "<p class=\"mt-8 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_Var4 string
|
var templ_7745c5c3_Var8 string
|
||||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.login.no_account"))
|
templ_7745c5c3_Var8, 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: 24, Col: 42}
|
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_Var4))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(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, 8, " <a class=\"text-ink underline underline-offset-2\" href=\"/signup\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, " <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_Var5 string
|
var templ_7745c5c3_Var9 string
|
||||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.login.to_signup"))
|
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.login.to_signup"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 25, Col: 105}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 39, Col: 105}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
_, 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, 9, "</a></p>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "</a></p>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -155,7 +207,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_Var7 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
templ_7745c5c3_Var11 := 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 {
|
||||||
@@ -167,7 +219,7 @@ func Signup(p Page) templ.Component {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "<form data-api=\"/auth/signup\" data-next=\"/\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "<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
|
||||||
}
|
}
|
||||||
@@ -187,7 +239,7 @@ 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, 11, "<hr class=\"my-6 border-rule\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "<hr class=\"my-6 border-rule\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -203,26 +255,26 @@ 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, 12, "</form><p class=\"mt-8 text-sm text-muted\"><a class=\"text-ink underline underline-offset-2\" href=\"/login\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</form><p class=\"mt-8 text-sm text-muted\"><a class=\"text-ink underline underline-offset-2\" href=\"/login\">")
|
||||||
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_Var12 string
|
||||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.signup.to_login"))
|
templ_7745c5c3_Var12, 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: 43, Col: 137}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 57, Col: 137}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
_, 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, 13, "</a></p>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</a></p>")
|
||||||
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 = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var11), templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
|||||||
|
|
||||||
// Me is the signed-in user as the console templates see it.
|
// Me is the signed-in user as the console templates see it.
|
||||||
type Me struct {
|
type Me struct {
|
||||||
|
// IsOwner refers to the active organization.
|
||||||
|
IsOwner bool
|
||||||
|
ActiveSlug string
|
||||||
Email string
|
Email string
|
||||||
DisplayName string
|
DisplayName string
|
||||||
TOTP bool
|
TOTP bool
|
||||||
@@ -35,6 +38,9 @@ templ consoleShell(p Page, me Me) {
|
|||||||
<span class="text-muted">{ me.Orgs[0].Name }</span>
|
<span class="text-muted">{ me.Orgs[0].Name }</span>
|
||||||
}
|
}
|
||||||
<nav class="ml-auto flex items-center gap-5">
|
<nav class="ml-auto flex items-center gap-5">
|
||||||
|
if me.IsOwner {
|
||||||
|
<a href="/settings/sso" class="text-muted hover:text-ink">{ i18n.T(ctx, "console.nav.sso") }</a>
|
||||||
|
}
|
||||||
<a href="/settings/security" class="text-muted hover:text-ink">{ i18n.T(ctx, "console.nav.security") }</a>
|
<a href="/settings/security" class="text-muted hover:text-ink">{ i18n.T(ctx, "console.nav.security") }</a>
|
||||||
<button data-logout class="text-muted hover:text-ink">{ i18n.T(ctx, "console.nav.logout") }</button>
|
<button data-logout class="text-muted hover:text-ink">{ i18n.T(ctx, "console.nav.logout") }</button>
|
||||||
@languageSwitch(p.Languages)
|
@languageSwitch(p.Languages)
|
||||||
@@ -50,6 +56,7 @@ templ consoleShell(p Page, me Me) {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<main class="mx-auto max-w-5xl px-6 py-10">
|
<main class="mx-auto max-w-5xl px-6 py-10">
|
||||||
|
@flash(p)
|
||||||
{ children... }
|
{ children... }
|
||||||
</main>
|
</main>
|
||||||
}
|
}
|
||||||
@@ -62,7 +69,13 @@ templ Dashboard(p Page, me Me) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
templ Security(p Page, me Me) {
|
// Identity is an SSO sign-in linked to the user in the active organization.
|
||||||
|
type Identity struct {
|
||||||
|
Provider string
|
||||||
|
Email string
|
||||||
|
}
|
||||||
|
|
||||||
|
templ Security(p Page, me Me, identities []Identity, canLink bool) {
|
||||||
@consoleShell(p, me) {
|
@consoleShell(p, me) {
|
||||||
<h1 class="mb-8 text-lg font-semibold">{ i18n.T(ctx, "security.title") }</h1>
|
<h1 class="mb-8 text-lg font-semibold">{ i18n.T(ctx, "security.title") }</h1>
|
||||||
<section class="max-w-md">
|
<section class="max-w-md">
|
||||||
@@ -91,5 +104,20 @@ templ Security(p Page, me Me) {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</section>
|
</section>
|
||||||
|
<section class="mt-12 max-w-md">
|
||||||
|
<h2 class="mb-3 text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "security.sso.heading") }</h2>
|
||||||
|
if len(identities) == 0 {
|
||||||
|
<p class="mb-4 text-sm text-muted">{ i18n.T(ctx, "security.sso.none") }</p>
|
||||||
|
} else {
|
||||||
|
<ul class="mb-4 divide-y divide-rule border-y border-rule text-sm">
|
||||||
|
for _, id := range identities {
|
||||||
|
<li class="flex justify-between gap-4 py-2"><span>{ id.Provider }</span><span class="font-mono text-xs text-muted">{ id.Email }</span></li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
}
|
||||||
|
if canLink {
|
||||||
|
<a href={ templ.SafeURL("/sso/" + me.ActiveSlug + "?link=1") } class="inline-block border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper">{ i18n.T(ctx, "security.sso.link") }</a>
|
||||||
|
}
|
||||||
|
</section>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+250
-105
@@ -13,6 +13,9 @@ import "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
|||||||
|
|
||||||
// Me is the signed-in user as the console templates see it.
|
// Me is the signed-in user as the console templates see it.
|
||||||
type Me struct {
|
type Me struct {
|
||||||
|
// IsOwner refers to the active organization.
|
||||||
|
IsOwner bool
|
||||||
|
ActiveSlug string
|
||||||
Email string
|
Email string
|
||||||
DisplayName string
|
DisplayName string
|
||||||
TOTP bool
|
TOTP bool
|
||||||
@@ -76,7 +79,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
var templ_7745c5c3_Var3 string
|
var templ_7745c5c3_Var3 string
|
||||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templruntime.NewAttributeExpression(o.ID).Resolve(ctx)
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templruntime.NewAttributeExpression(o.ID).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: 31, Col: 27}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 34, Col: 27}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -99,7 +102,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
var templ_7745c5c3_Var4 string
|
var templ_7745c5c3_Var4 string
|
||||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(o.Name)
|
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(o.Name)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 31, Col: 73}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 34, Col: 73}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -122,7 +125,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
var templ_7745c5c3_Var5 string
|
var templ_7745c5c3_Var5 string
|
||||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(me.Orgs[0].Name)
|
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(me.Orgs[0].Name)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 35, Col: 47}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 38, Col: 47}
|
||||||
}
|
}
|
||||||
_, 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 {
|
||||||
@@ -133,33 +136,56 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "<nav class=\"ml-auto flex items-center gap-5\"><a href=\"/settings/security\" class=\"text-muted hover:text-ink\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "<nav class=\"ml-auto flex items-center gap-5\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var6 string
|
if me.IsOwner {
|
||||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.security"))
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "<a href=\"/settings/sso\" class=\"text-muted hover:text-ink\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 38, Col: 105}
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var6 string
|
||||||
|
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.sso"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 42, Col: 96}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "</a> ")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "<a href=\"/settings/security\" class=\"text-muted hover:text-ink\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "</a> <button data-logout 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_Var7 string
|
var templ_7745c5c3_Var7 string
|
||||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout"))
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.security"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 39, Col: 94}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 44, Col: 105}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(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, 13, "</button>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "</a> <button data-logout 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.nav.logout"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 45, Col: 94}
|
||||||
|
}
|
||||||
|
_, 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, "</button>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -167,43 +193,47 @@ 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, 14, "</nav></div></header>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</nav></div></header>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
if me.TOTPMissing {
|
if me.TOTPMissing {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "<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, 18, "<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_Var8 string
|
|
||||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.totp_missing"))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 47, Col: 42}
|
|
||||||
}
|
|
||||||
_, 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 href=\"/settings/security\" 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_Var9 string
|
var templ_7745c5c3_Var9 string
|
||||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.totp_missing_action"))
|
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.totp_missing"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 48, Col: 115}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 53, Col: 42}
|
||||||
}
|
}
|
||||||
_, 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></p></div>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " <a href=\"/settings/security\" class=\"underline underline-offset-2\">")
|
||||||
|
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.totp_missing_action"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 54, Col: 115}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "</a></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, 18, " <main class=\"mx-auto max-w-5xl px-6 py-10\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, " <main class=\"mx-auto max-w-5xl px-6 py-10\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = flash(p).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -211,7 +241,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, 19, "</main>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "</main>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -242,7 +272,7 @@ func Dashboard(p Page, me Me) templ.Component {
|
|||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
templ_7745c5c3_Var11 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
templ_7745c5c3_Var12 := 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 {
|
||||||
@@ -254,39 +284,39 @@ func Dashboard(p Page, me Me) templ.Component {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "<h1 class=\"text-lg font-semibold\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "<h1 class=\"text-lg font-semibold\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var12 string
|
|
||||||
templ_7745c5c3_Var12, 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: 60, Col: 75}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "</h1><p class=\"mt-2 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_Var13 string
|
var templ_7745c5c3_Var13 string
|
||||||
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.empty"))
|
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.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: 76}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 67, Col: 75}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
||||||
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, "</p>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "</h1><p class=\"mt-2 text-sm text-muted\">")
|
||||||
|
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.monitors.empty"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 68, Col: 76}
|
||||||
|
}
|
||||||
|
_, 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, "</p>")
|
||||||
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_Var11), templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var12), templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -294,7 +324,13 @@ func Dashboard(p Page, me Me) templ.Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func Security(p Page, me Me) templ.Component {
|
// Identity is an SSO sign-in linked to the user in the active organization.
|
||||||
|
type Identity struct {
|
||||||
|
Provider string
|
||||||
|
Email string
|
||||||
|
}
|
||||||
|
|
||||||
|
func Security(p Page, me Me, identities []Identity, canLink bool) templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
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
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
@@ -311,7 +347,7 @@ func Security(p Page, me Me) templ.Component {
|
|||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
templ_7745c5c3_Var15 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
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_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 {
|
||||||
@@ -323,51 +359,51 @@ func Security(p Page, me Me) templ.Component {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "<h1 class=\"mb-8 text-lg font-semibold\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "<h1 class=\"mb-8 text-lg font-semibold\">")
|
||||||
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, "security.title"))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 67, Col: 72}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "</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_Var17 string
|
var templ_7745c5c3_Var17 string
|
||||||
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.heading"))
|
templ_7745c5c3_Var17, 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: 69, Col: 114}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 80, 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_Var17))
|
||||||
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, 25, "</h2>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "</h1><section class=\"max-w-md\"><h2 class=\"mb-1 text-xs font-medium uppercase tracking-wider 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, "security.totp.heading"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 82, Col: 114}
|
||||||
|
}
|
||||||
|
_, 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, 28, "</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, 26, "<p class=\"mb-6 text-sm\"><span class=\"text-up\">●</span> ")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "<p class=\"mb-6 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_Var18 string
|
var templ_7745c5c3_Var19 string
|
||||||
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.active"))
|
templ_7745c5c3_Var19, 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: 71, Col: 98}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 84, Col: 98}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
_, 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, 27, "</p><form data-api=\"/me/totp/disable\" data-next=\"/settings/security\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "</p><form data-api=\"/me/totp/disable\" data-next=\"/settings/security\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -387,51 +423,51 @@ func Security(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, 28, "</form>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "</form>")
|
||||||
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, 29, "<p class=\"mb-6 text-sm\"><span class=\"text-unknown\">●</span> ")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "<p class=\"mb-6 text-sm\"><span class=\"text-unknown\">●</span> ")
|
||||||
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, "security.totp.inactive"))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 79, Col: 105}
|
|
||||||
}
|
|
||||||
_, 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, 30, "</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 {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var20 string
|
var templ_7745c5c3_Var20 string
|
||||||
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.start"))
|
templ_7745c5c3_Var20, 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: 81, Col: 141}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 92, Col: 105}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
|
_, 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, 31, "</button><div data-totp-panel hidden><img data-totp-qr alt=\"")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "</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 {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var21 string
|
var templ_7745c5c3_Var21 string
|
||||||
templ_7745c5c3_Var21, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "security.totp.qr_alt")).Resolve(ctx)
|
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.start"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 83, Col: 65}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 94, Col: 141}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var21)
|
_, 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, 32, "\" 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-next=\"/settings/security\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "</button><div data-totp-panel hidden><img data-totp-qr alt=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var22 string
|
||||||
|
templ_7745c5c3_Var22, 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: 96, Col: 65}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var22)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "\" 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-next=\"/settings/security\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -447,18 +483,127 @@ func Security(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, 33, "</form></div></div>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "</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, 34, "</section>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "</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 {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var23 string
|
||||||
|
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.heading"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 108, Col: 113}
|
||||||
|
}
|
||||||
|
_, 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, 38, "</h2>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
if len(identities) == 0 {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "<p class=\"mb-4 text-sm text-muted\">")
|
||||||
|
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, "security.sso.none"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 110, Col: 73}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
|
||||||
|
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
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "<ul class=\"mb-4 divide-y divide-rule border-y border-rule text-sm\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
for _, id := range identities {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "<li class=\"flex justify-between gap-4 py-2\"><span>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var25 string
|
||||||
|
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(id.Provider)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 114, Col: 69}
|
||||||
|
}
|
||||||
|
_, 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, 43, "</span><span class=\"font-mono text-xs text-muted\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var26 string
|
||||||
|
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(id.Email)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 114, Col: 131}
|
||||||
|
}
|
||||||
|
_, 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, 44, "</span></li>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "</ul>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if canLink {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "<a href=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var27 string
|
||||||
|
templ_7745c5c3_Var27, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/sso/" + me.ActiveSlug + "?link=1")).ResolveURL(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 119, Col: 64}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var27)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "\" class=\"inline-block 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.sso.link"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 119, Col: 190}
|
||||||
|
}
|
||||||
|
_, 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, "</a>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "</section>")
|
||||||
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_Var15), templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var16), templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ type Page struct {
|
|||||||
TitleID string
|
TitleID string
|
||||||
CSRF string
|
CSRF string
|
||||||
Languages []string
|
Languages []string
|
||||||
|
// ErrorID and NoticeID name catalog messages shown above the content,
|
||||||
|
// typically after a redirect back from an SSO flow.
|
||||||
|
ErrorID string
|
||||||
|
NoticeID string
|
||||||
}
|
}
|
||||||
|
|
||||||
templ Layout(p Page) {
|
templ Layout(p Page) {
|
||||||
@@ -49,6 +53,7 @@ templ authShell(p Page) {
|
|||||||
@languageSwitch(p.Languages)
|
@languageSwitch(p.Languages)
|
||||||
</div>
|
</div>
|
||||||
<h1 class="mb-6 text-xl font-semibold">{ i18n.T(ctx, p.TitleID) }</h1>
|
<h1 class="mb-6 text-xl font-semibold">{ i18n.T(ctx, p.TitleID) }</h1>
|
||||||
|
@flash(p)
|
||||||
{ children... }
|
{ children... }
|
||||||
</main>
|
</main>
|
||||||
}
|
}
|
||||||
@@ -73,6 +78,15 @@ templ submit(label string) {
|
|||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
templ flash(p Page) {
|
||||||
|
if p.ErrorID != "" {
|
||||||
|
<p class="mb-6 border-l-2 border-down pl-2 text-sm text-down">{ i18n.T(ctx, p.ErrorID) }</p>
|
||||||
|
}
|
||||||
|
if p.NoticeID != "" {
|
||||||
|
<p class="mb-6 border-l-2 border-up pl-2 text-sm">{ i18n.T(ctx, p.NoticeID) }</p>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
templ formError() {
|
templ formError() {
|
||||||
<p data-error class="mb-4 hidden border-l-2 border-down pl-2 text-sm text-down"></p>
|
<p data-error class="mb-4 hidden border-l-2 border-down pl-2 text-sm text-down"></p>
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,10 @@ type Page struct {
|
|||||||
TitleID string
|
TitleID string
|
||||||
CSRF string
|
CSRF string
|
||||||
Languages []string
|
Languages []string
|
||||||
|
// ErrorID and NoticeID name catalog messages shown above the content,
|
||||||
|
// typically after a redirect back from an SSO flow.
|
||||||
|
ErrorID string
|
||||||
|
NoticeID string
|
||||||
}
|
}
|
||||||
|
|
||||||
func Layout(p Page) templ.Component {
|
func Layout(p Page) templ.Component {
|
||||||
@@ -43,7 +47,7 @@ func Layout(p Page) templ.Component {
|
|||||||
var templ_7745c5c3_Var2 string
|
var templ_7745c5c3_Var2 string
|
||||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.Lang(ctx)).Resolve(ctx)
|
templ_7745c5c3_Var2, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.Lang(ctx)).Resolve(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 14, Col: 28}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 18, Col: 28}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var2)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var2)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -61,7 +65,7 @@ func Layout(p Page) templ.Component {
|
|||||||
var templ_7745c5c3_Var3 string
|
var templ_7745c5c3_Var3 string
|
||||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templruntime.NewAttributeExpression(p.CSRF).Resolve(ctx)
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templruntime.NewAttributeExpression(p.CSRF).Resolve(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 19, Col: 44}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 23, Col: 44}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -79,7 +83,7 @@ func Layout(p Page) templ.Component {
|
|||||||
var templ_7745c5c3_Var4 string
|
var templ_7745c5c3_Var4 string
|
||||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, p.TitleID))
|
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, p.TitleID))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 21, Col: 34}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 25, Col: 34}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -92,7 +96,7 @@ func Layout(p Page) templ.Component {
|
|||||||
var templ_7745c5c3_Var5 string
|
var templ_7745c5c3_Var5 string
|
||||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "app.network_error")).Resolve(ctx)
|
templ_7745c5c3_Var5, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "app.network_error")).Resolve(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 26, Col: 80}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 30, Col: 80}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var5)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var5)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -144,7 +148,7 @@ func languageSwitch(langs []string) templ.Component {
|
|||||||
var templ_7745c5c3_Var7 string
|
var templ_7745c5c3_Var7 string
|
||||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(l)
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(l)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 36, Col: 50}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 40, Col: 50}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -162,7 +166,7 @@ func languageSwitch(langs []string) templ.Component {
|
|||||||
var templ_7745c5c3_Var8 string
|
var templ_7745c5c3_Var8 string
|
||||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templruntime.NewAttributeExpression(l).Resolve(ctx)
|
templ_7745c5c3_Var8, templ_7745c5c3_Err = templruntime.NewAttributeExpression(l).Resolve(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 38, Col: 41}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 42, Col: 41}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -175,7 +179,7 @@ func languageSwitch(langs []string) templ.Component {
|
|||||||
var templ_7745c5c3_Var9 string
|
var templ_7745c5c3_Var9 string
|
||||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "lang."+l)).Resolve(ctx)
|
templ_7745c5c3_Var9, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "lang."+l)).Resolve(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 38, Col: 108}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 42, Col: 108}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -188,7 +192,7 @@ func languageSwitch(langs []string) templ.Component {
|
|||||||
var templ_7745c5c3_Var10 string
|
var templ_7745c5c3_Var10 string
|
||||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(l)
|
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(l)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 38, Col: 114}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 42, Col: 114}
|
||||||
}
|
}
|
||||||
_, 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 {
|
||||||
@@ -253,7 +257,7 @@ func authShell(p Page) templ.Component {
|
|||||||
var templ_7745c5c3_Var13 string
|
var templ_7745c5c3_Var13 string
|
||||||
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, p.TitleID))
|
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, p.TitleID))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 51, Col: 66}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 55, Col: 66}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -263,6 +267,10 @@ func authShell(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 = flash(p).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
templ_7745c5c3_Err = templ_7745c5c3_Var11.Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = templ_7745c5c3_Var11.Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
@@ -305,7 +313,7 @@ func field(label, name, typ, autocomplete string, required bool) templ.Component
|
|||||||
var templ_7745c5c3_Var15 string
|
var templ_7745c5c3_Var15 string
|
||||||
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(label)
|
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(label)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 59, Col: 90}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 64, Col: 90}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -318,7 +326,7 @@ func field(label, name, typ, autocomplete string, required bool) templ.Component
|
|||||||
var templ_7745c5c3_Var16 string
|
var templ_7745c5c3_Var16 string
|
||||||
templ_7745c5c3_Var16, templ_7745c5c3_Err = templruntime.NewAttributeExpression(typ).Resolve(ctx)
|
templ_7745c5c3_Var16, templ_7745c5c3_Err = templruntime.NewAttributeExpression(typ).Resolve(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 62, Col: 13}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 67, Col: 13}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var16)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var16)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -331,7 +339,7 @@ func field(label, name, typ, autocomplete string, required bool) templ.Component
|
|||||||
var templ_7745c5c3_Var17 string
|
var templ_7745c5c3_Var17 string
|
||||||
templ_7745c5c3_Var17, templ_7745c5c3_Err = templruntime.NewAttributeExpression(name).Resolve(ctx)
|
templ_7745c5c3_Var17, templ_7745c5c3_Err = templruntime.NewAttributeExpression(name).Resolve(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 63, Col: 14}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 68, Col: 14}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var17)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var17)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -344,7 +352,7 @@ func field(label, name, typ, autocomplete string, required bool) templ.Component
|
|||||||
var templ_7745c5c3_Var18 string
|
var templ_7745c5c3_Var18 string
|
||||||
templ_7745c5c3_Var18, templ_7745c5c3_Err = templruntime.NewAttributeExpression(autocomplete).Resolve(ctx)
|
templ_7745c5c3_Var18, templ_7745c5c3_Err = templruntime.NewAttributeExpression(autocomplete).Resolve(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 64, Col: 30}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 69, Col: 30}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var18)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var18)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -392,7 +400,7 @@ func submit(label string) templ.Component {
|
|||||||
var templ_7745c5c3_Var20 string
|
var templ_7745c5c3_Var20 string
|
||||||
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(label)
|
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(label)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 72, Col: 9}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 77, Col: 9}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -406,6 +414,65 @@ func submit(label string) templ.Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func flash(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)
|
||||||
|
if p.ErrorID != "" {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "<p class=\"mb-6 border-l-2 border-down pl-2 text-sm text-down\">")
|
||||||
|
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, p.ErrorID))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 83, Col: 88}
|
||||||
|
}
|
||||||
|
_, 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, 31, "</p>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if p.NoticeID != "" {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "<p class=\"mb-6 border-l-2 border-up pl-2 text-sm\">")
|
||||||
|
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, p.NoticeID))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 86, Col: 77}
|
||||||
|
}
|
||||||
|
_, 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, 33, "</p>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func formError() templ.Component {
|
func formError() templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
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
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
@@ -423,7 +490,7 @@ func formError() 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, 30, "<p data-error class=\"mb-4 hidden border-l-2 border-down pl-2 text-sm text-down\"></p>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "<p data-error class=\"mb-4 hidden border-l-2 border-down pl-2 text-sm text-down\"></p>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,156 @@
|
|||||||
|
package web
|
||||||
|
|
||||||
|
import "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
||||||
|
|
||||||
|
// SSOOption is one provider on the chooser page.
|
||||||
|
type SSOOption struct {
|
||||||
|
Name string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
templ SSOChooser(p Page, opts []SSOOption) {
|
||||||
|
@authShell(p) {
|
||||||
|
<ul class="divide-y divide-rule border-y border-rule">
|
||||||
|
for _, o := range opts {
|
||||||
|
<li><a href={ templ.SafeURL(o.URL) } class="block py-2.5 hover:underline">{ o.Name }</a></li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
<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>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SSOProvider is a provider row on the settings page.
|
||||||
|
type SSOProvider struct {
|
||||||
|
ID string
|
||||||
|
Name string
|
||||||
|
Issuer string
|
||||||
|
ClientID string
|
||||||
|
HasSecret bool
|
||||||
|
AllowedDomains string
|
||||||
|
AutoProvision bool
|
||||||
|
Enabled bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// SSOSettings is the data of the organization SSO page.
|
||||||
|
type SSOSettings struct {
|
||||||
|
Providers []SSOProvider
|
||||||
|
RedirectURL string
|
||||||
|
LoginURL string
|
||||||
|
}
|
||||||
|
|
||||||
|
templ SSOSettingsPage(p Page, me Me, s SSOSettings) {
|
||||||
|
@consoleShell(p, me) {
|
||||||
|
<h1 class="mb-2 text-lg font-semibold">{ i18n.T(ctx, "sso.settings.title") }</h1>
|
||||||
|
<p class="mb-8 max-w-2xl text-sm text-muted">{ i18n.T(ctx, "sso.settings.intro") }</p>
|
||||||
|
<dl class="mb-10 grid max-w-2xl grid-cols-[max-content_1fr] gap-x-6 gap-y-2 text-sm">
|
||||||
|
<dt class="text-muted">{ i18n.T(ctx, "sso.settings.redirect_url") }</dt>
|
||||||
|
<dd class="break-all font-mono text-xs leading-5">{ s.RedirectURL }</dd>
|
||||||
|
<dt class="text-muted">{ i18n.T(ctx, "sso.settings.login_url") }</dt>
|
||||||
|
<dd class="break-all font-mono text-xs leading-5">{ s.LoginURL }</dd>
|
||||||
|
</dl>
|
||||||
|
if len(s.Providers) > 0 {
|
||||||
|
<table class="mb-12 w-full max-w-4xl text-left text-sm">
|
||||||
|
<thead class="border-b border-rule text-xs uppercase tracking-wider text-muted">
|
||||||
|
<tr>
|
||||||
|
<th class="py-2 pr-4 font-medium">{ i18n.T(ctx, "sso.field.name") }</th>
|
||||||
|
<th class="py-2 pr-4 font-medium">{ i18n.T(ctx, "sso.field.issuer") }</th>
|
||||||
|
<th class="py-2 pr-4 font-medium">{ i18n.T(ctx, "sso.field.auto_provision") }</th>
|
||||||
|
<th class="py-2 pr-4 font-medium">{ i18n.T(ctx, "sso.field.enabled") }</th>
|
||||||
|
<th class="py-2"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="divide-y divide-rule">
|
||||||
|
for _, pr := range s.Providers {
|
||||||
|
<tr class="align-top">
|
||||||
|
<td class="py-2.5 pr-4">{ pr.Name }</td>
|
||||||
|
<td class="py-2.5 pr-4 break-all font-mono text-xs">{ pr.Issuer }</td>
|
||||||
|
<td class="py-2.5 pr-4">@yesNo(pr.AutoProvision)</td>
|
||||||
|
<td class="py-2.5 pr-4">@yesNo(pr.Enabled)</td>
|
||||||
|
<td class="py-2.5 text-right">
|
||||||
|
<details class="inline-block text-left">
|
||||||
|
<summary class="cursor-pointer text-muted hover:text-ink">{ i18n.T(ctx, "sso.action.edit") }</summary>
|
||||||
|
<div class="mt-4 w-80">
|
||||||
|
@ssoForm(pr, "put", "/org/sso/"+pr.ID)
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
data-delete={ "/org/sso/" + pr.ID }
|
||||||
|
data-confirm={ i18n.T(ctx, "sso.action.delete_confirm") }
|
||||||
|
class="mt-4 text-sm text-down hover:underline"
|
||||||
|
>{ i18n.T(ctx, "sso.action.delete") }</button>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
<section class="max-w-md">
|
||||||
|
<h2 class="mb-4 text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "sso.settings.add") }</h2>
|
||||||
|
@ssoForm(SSOProvider{Enabled: true}, "post", "/org/sso")
|
||||||
|
</section>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
templ yesNo(v bool) {
|
||||||
|
if v {
|
||||||
|
<span class="text-up">●</span> { i18n.T(ctx, "common.yes") }
|
||||||
|
} else {
|
||||||
|
<span class="text-unknown">●</span> { i18n.T(ctx, "common.no") }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
templ ssoForm(pr SSOProvider, method, action string) {
|
||||||
|
<form data-api={ action } data-method={ method } data-next="/settings/sso">
|
||||||
|
@formError()
|
||||||
|
@valueField(i18n.T(ctx, "sso.field.name"), "name", pr.Name, "", true)
|
||||||
|
@valueField(i18n.T(ctx, "sso.field.issuer"), "issuer", pr.Issuer, "https://login.example.com/realms/acme", true)
|
||||||
|
@valueField(i18n.T(ctx, "sso.field.client_id"), "client_id", pr.ClientID, "", true)
|
||||||
|
<label class="mb-4 block">
|
||||||
|
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "sso.field.client_secret") }</span>
|
||||||
|
<input
|
||||||
|
class="w-full border border-rule bg-transparent px-2.5 py-1.5 outline-none focus:border-ink"
|
||||||
|
type="password"
|
||||||
|
name="client_secret"
|
||||||
|
autocomplete="off"
|
||||||
|
if pr.HasSecret {
|
||||||
|
placeholder={ i18n.T(ctx, "sso.field.client_secret_keep") }
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<label class="mb-4 block">
|
||||||
|
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "sso.field.allowed_domains") }</span>
|
||||||
|
<input
|
||||||
|
class="w-full border border-rule bg-transparent px-2.5 py-1.5 font-mono text-sm outline-none focus:border-ink"
|
||||||
|
name="allowed_domains"
|
||||||
|
data-list
|
||||||
|
value={ pr.AllowedDomains }
|
||||||
|
placeholder="example.com, example.org"
|
||||||
|
/>
|
||||||
|
<span class="mt-1 block text-xs text-muted">{ i18n.T(ctx, "sso.field.allowed_domains_hint") }</span>
|
||||||
|
</label>
|
||||||
|
@checkbox(i18n.T(ctx, "sso.field.auto_provision"), "auto_provision", pr.AutoProvision)
|
||||||
|
@checkbox(i18n.T(ctx, "sso.field.enabled"), "enabled", pr.Enabled)
|
||||||
|
@submit(i18n.T(ctx, "common.save"))
|
||||||
|
</form>
|
||||||
|
}
|
||||||
|
|
||||||
|
templ valueField(label, name, value, placeholder string, required bool) {
|
||||||
|
<label class="mb-4 block">
|
||||||
|
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ label }</span>
|
||||||
|
<input
|
||||||
|
class="w-full border border-rule bg-transparent px-2.5 py-1.5 outline-none focus:border-ink"
|
||||||
|
name={ name }
|
||||||
|
value={ value }
|
||||||
|
placeholder={ placeholder }
|
||||||
|
required?={ required }
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
}
|
||||||
|
|
||||||
|
templ checkbox(label, name string, checked bool) {
|
||||||
|
<label class="mb-3 flex items-center gap-2 text-sm">
|
||||||
|
<input type="checkbox" name={ name } checked?={ checked } class="accent-ink"/>
|
||||||
|
{ label }
|
||||||
|
</label>
|
||||||
|
}
|
||||||
@@ -0,0 +1,807 @@
|
|||||||
|
// Code generated by templ - DO NOT EDIT.
|
||||||
|
|
||||||
|
// templ: version: v0.3.1118
|
||||||
|
|
||||||
|
package web
|
||||||
|
|
||||||
|
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||||
|
|
||||||
|
import "github.com/a-h/templ"
|
||||||
|
import templruntime "github.com/a-h/templ/runtime"
|
||||||
|
|
||||||
|
import "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
||||||
|
|
||||||
|
// SSOOption is one provider on the chooser page.
|
||||||
|
type SSOOption struct {
|
||||||
|
Name string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
func SSOChooser(p Page, opts []SSOOption) 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_Var2 := 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, 1, "<ul class=\"divide-y divide-rule border-y border-rule\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
for _, o := range opts {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<li><a href=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var3 string
|
||||||
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(o.URL)).ResolveURL(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 15, Col: 38}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\" class=\"block py-2.5 hover:underline\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var4 string
|
||||||
|
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(o.Name)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 15, Col: 86}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</a></li>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</ul><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_Var5 string
|
||||||
|
templ_7745c5c3_Var5, 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/sso.templ`, Line: 18, Col: 137}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</a></p>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
templ_7745c5c3_Err = authShell(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// SSOProvider is a provider row on the settings page.
|
||||||
|
type SSOProvider struct {
|
||||||
|
ID string
|
||||||
|
Name string
|
||||||
|
Issuer string
|
||||||
|
ClientID string
|
||||||
|
HasSecret bool
|
||||||
|
AllowedDomains string
|
||||||
|
AutoProvision bool
|
||||||
|
Enabled bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// SSOSettings is the data of the organization SSO page.
|
||||||
|
type SSOSettings struct {
|
||||||
|
Providers []SSOProvider
|
||||||
|
RedirectURL string
|
||||||
|
LoginURL string
|
||||||
|
}
|
||||||
|
|
||||||
|
func SSOSettingsPage(p Page, me Me, s SSOSettings) 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_Var7 := 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, 7, "<h1 class=\"mb-2 text-lg font-semibold\">")
|
||||||
|
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, "sso.settings.title"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 43, Col: 76}
|
||||||
|
}
|
||||||
|
_, 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, 8, "</h1><p class=\"mb-8 max-w-2xl 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, "sso.settings.intro"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 44, Col: 82}
|
||||||
|
}
|
||||||
|
_, 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, 9, "</p><dl class=\"mb-10 grid max-w-2xl grid-cols-[max-content_1fr] gap-x-6 gap-y-2 text-sm\"><dt class=\"text-muted\">")
|
||||||
|
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, "sso.settings.redirect_url"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 46, Col: 68}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "</dt><dd class=\"break-all font-mono text-xs leading-5\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var11 string
|
||||||
|
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(s.RedirectURL)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 47, Col: 68}
|
||||||
|
}
|
||||||
|
_, 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, 11, "</dd><dt class=\"text-muted\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var12 string
|
||||||
|
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.settings.login_url"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 48, Col: 65}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "</dt><dd class=\"break-all font-mono text-xs leading-5\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var13 string
|
||||||
|
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(s.LoginURL)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 49, Col: 65}
|
||||||
|
}
|
||||||
|
_, 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, 13, "</dd></dl>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
if len(s.Providers) > 0 {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "<table class=\"mb-12 w-full max-w-4xl text-left text-sm\"><thead class=\"border-b border-rule text-xs uppercase tracking-wider text-muted\"><tr><th class=\"py-2 pr-4 font-medium\">")
|
||||||
|
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, "sso.field.name"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 55, Col: 71}
|
||||||
|
}
|
||||||
|
_, 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, 15, "</th><th class=\"py-2 pr-4 font-medium\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var15 string
|
||||||
|
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.field.issuer"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 56, Col: 73}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</th><th class=\"py-2 pr-4 font-medium\">")
|
||||||
|
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, "sso.field.auto_provision"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 57, Col: 81}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</th><th class=\"py-2 pr-4 font-medium\">")
|
||||||
|
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, "sso.field.enabled"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 58, Col: 74}
|
||||||
|
}
|
||||||
|
_, 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, 18, "</th><th class=\"py-2\"></th></tr></thead> <tbody class=\"divide-y divide-rule\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
for _, pr := range s.Providers {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "<tr class=\"align-top\"><td class=\"py-2.5 pr-4\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var18 string
|
||||||
|
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(pr.Name)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 65, Col: 40}
|
||||||
|
}
|
||||||
|
_, 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, 20, "</td><td class=\"py-2.5 pr-4 break-all font-mono text-xs\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var19 string
|
||||||
|
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(pr.Issuer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 66, Col: 70}
|
||||||
|
}
|
||||||
|
_, 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, 21, "</td><td class=\"py-2.5 pr-4\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = yesNo(pr.AutoProvision).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "</td><td class=\"py-2.5 pr-4\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = yesNo(pr.Enabled).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "</td><td class=\"py-2.5 text-right\"><details class=\"inline-block text-left\"><summary class=\"cursor-pointer text-muted hover:text-ink\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var20 string
|
||||||
|
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.action.edit"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 71, Col: 99}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "</summary><div class=\"mt-4 w-80\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = ssoForm(pr, "put", "/org/sso/"+pr.ID).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "<button type=\"button\" data-delete=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var21 string
|
||||||
|
templ_7745c5c3_Var21, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/sso/" + pr.ID).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 76, Col: 44}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var21)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "\" data-confirm=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var22 string
|
||||||
|
templ_7745c5c3_Var22, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "sso.action.delete_confirm")).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 77, Col: 66}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var22)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "\" class=\"mt-4 text-sm text-down hover:underline\">")
|
||||||
|
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, "sso.action.delete"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 79, Col: 45}
|
||||||
|
}
|
||||||
|
_, 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, 28, "</button></div></details></td></tr>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</tbody></table>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, " <section class=\"max-w-md\"><h2 class=\"mb-4 text-xs font-medium uppercase tracking-wider text-muted\">")
|
||||||
|
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, "sso.settings.add"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 89, Col: 109}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "</h2>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = ssoForm(SSOProvider{Enabled: true}, "post", "/org/sso").Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "</section>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func yesNo(v bool) 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 v {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "<span class=\"text-up\">●</span> ")
|
||||||
|
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, "common.yes"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 97, Col: 62}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "<span class=\"text-unknown\">●</span> ")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var27 string
|
||||||
|
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "common.no"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 99, Col: 66}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func ssoForm(pr SSOProvider, method, action 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_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "<form data-api=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var29 string
|
||||||
|
templ_7745c5c3_Var29, templ_7745c5c3_Err = templruntime.NewAttributeExpression(action).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 104, Col: 24}
|
||||||
|
}
|
||||||
|
_, 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, 36, "\" data-method=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var30 string
|
||||||
|
templ_7745c5c3_Var30, templ_7745c5c3_Err = templruntime.NewAttributeExpression(method).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 104, Col: 47}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var30)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "\" data-next=\"/settings/sso\">")
|
||||||
|
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 = valueField(i18n.T(ctx, "sso.field.name"), "name", pr.Name, "", true).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = valueField(i18n.T(ctx, "sso.field.issuer"), "issuer", pr.Issuer, "https://login.example.com/realms/acme", true).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = valueField(i18n.T(ctx, "sso.field.client_id"), "client_id", pr.ClientID, "", true).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "<label class=\"mb-4 block\"><span class=\"mb-1 block text-xs font-medium uppercase tracking-wider text-muted\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var31 string
|
||||||
|
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.field.client_secret"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 110, Col: 124}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "</span> <input class=\"w-full border border-rule bg-transparent px-2.5 py-1.5 outline-none focus:border-ink\" type=\"password\" name=\"client_secret\" autocomplete=\"off\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
if pr.HasSecret {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, " placeholder=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var32 string
|
||||||
|
templ_7745c5c3_Var32, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "sso.field.client_secret_keep")).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 117, Col: 62}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var32)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "></label> <label class=\"mb-4 block\"><span class=\"mb-1 block text-xs font-medium uppercase tracking-wider text-muted\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var33 string
|
||||||
|
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.field.allowed_domains"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 122, Col: 126}
|
||||||
|
}
|
||||||
|
_, 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, 43, "</span> <input class=\"w-full border border-rule bg-transparent px-2.5 py-1.5 font-mono text-sm outline-none focus:border-ink\" name=\"allowed_domains\" data-list value=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var34 string
|
||||||
|
templ_7745c5c3_Var34, templ_7745c5c3_Err = templruntime.NewAttributeExpression(pr.AllowedDomains).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 127, Col: 29}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var34)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "\" placeholder=\"example.com, example.org\"> <span class=\"mt-1 block text-xs 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, "sso.field.allowed_domains_hint"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 130, Col: 94}
|
||||||
|
}
|
||||||
|
_, 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, 45, "</span></label>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = checkbox(i18n.T(ctx, "sso.field.auto_provision"), "auto_provision", pr.AutoProvision).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = checkbox(i18n.T(ctx, "sso.field.enabled"), "enabled", pr.Enabled).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
|
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, 46, "</form>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func valueField(label, name, value, placeholder string, required bool) 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, 47, "<label class=\"mb-4 block\"><span class=\"mb-1 block text-xs font-medium uppercase tracking-wider text-muted\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var37 string
|
||||||
|
templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(label)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 140, Col: 90}
|
||||||
|
}
|
||||||
|
_, 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, 48, "</span> <input class=\"w-full border border-rule bg-transparent px-2.5 py-1.5 outline-none focus:border-ink\" name=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var38 string
|
||||||
|
templ_7745c5c3_Var38, templ_7745c5c3_Err = templruntime.NewAttributeExpression(name).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 143, Col: 14}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var38)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "\" value=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var39 string
|
||||||
|
templ_7745c5c3_Var39, templ_7745c5c3_Err = templruntime.NewAttributeExpression(value).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 144, Col: 16}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var39)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "\" placeholder=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var40 string
|
||||||
|
templ_7745c5c3_Var40, templ_7745c5c3_Err = templruntime.NewAttributeExpression(placeholder).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 145, Col: 28}
|
||||||
|
}
|
||||||
|
_, 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, 51, "\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
if required {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, " required")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "></label>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkbox(label, name string, checked bool) 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, 54, "<label class=\"mb-3 flex items-center gap-2 text-sm\"><input type=\"checkbox\" name=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var42 string
|
||||||
|
templ_7745c5c3_Var42, templ_7745c5c3_Err = templruntime.NewAttributeExpression(name).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 153, Col: 36}
|
||||||
|
}
|
||||||
|
_, 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, 55, "\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
if checked {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, " checked")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, " class=\"accent-ink\"> ")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var43 string
|
||||||
|
templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(label)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/sso.templ`, Line: 154, Col: 9}
|
||||||
|
}
|
||||||
|
_, 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, 58, "</label>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ = templruntime.GeneratedTemplate
|
||||||
Reference in new issue
Block a user