feat(api): accept recovery codes as second factor and let users regenerate them

Enabling TOTP returns ten codes that are shown once. Disabling TOTP and
regenerating codes require the password plus a current code.

Closes #40

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 00:35:20 +01:00
1 parent dbea42e7a5
commit 7b063d2cd8
12 files changed
+559 -172

No files matched your search

+7 -2
View File
@@ -167,12 +167,17 @@ func (s *Server) login(c *gin.Context) {
s.finishLogin(c, user.ID) s.finishLogin(c, user.ID)
} }
// secondFactorRequest carries a TOTP code or a recovery code.
type secondFactorRequest struct {
Code string `json:"code" binding:"required,max=32"`
}
type totpRequest struct { type totpRequest struct {
Code string `json:"code" binding:"required,len=6,numeric"` Code string `json:"code" binding:"required,len=6,numeric"`
} }
func (s *Server) loginTOTP(c *gin.Context) { func (s *Server) loginTOTP(c *gin.Context) {
var req totpRequest var req secondFactorRequest
if !bind(c, &req) { if !bind(c, &req) {
return return
} }
@@ -195,7 +200,7 @@ func (s *Server) loginTOTP(c *gin.Context) {
internalError(c, err) internalError(c, err)
return return
} }
ok, err := s.verifyUserTOTP(ctx, userID, req.Code) ok, err := s.verifySecondFactor(ctx, userID, req.Code)
if err != nil { if err != nil {
internalError(c, err) internalError(c, err)
return return
+102 -34
View File
@@ -37,6 +37,7 @@ type meView struct {
Orgs []orgView `json:"orgs"` Orgs []orgView `json:"orgs"`
// Set when an org the user belongs to enforces TOTP and the user has none. // Set when an org the user belongs to enforces TOTP and the user has none.
TOTPEnrollmentRequired bool `json:"totp_enrollment_required"` TOTPEnrollmentRequired bool `json:"totp_enrollment_required"`
RecoveryCodesLeft int `json:"recovery_codes_left"`
} }
func (s *Server) loadMe(ctx context.Context, sess *auth.Session) (meView, error) { func (s *Server) loadMe(ctx context.Context, sess *auth.Session) (meView, error) {
@@ -46,11 +47,15 @@ func (s *Server) loadMe(ctx context.Context, sess *auth.Session) (meView, error)
if err != nil { if err != nil {
return err return err
} }
left, err := q.CountUnusedRecoveryCodes(ctx, sess.UserID)
if err != nil {
return err
}
orgs, err := q.ListUserOrgs(ctx, sess.UserID) orgs, err := q.ListUserOrgs(ctx, sess.UserID)
if err != nil { if err != nil {
return err return err
} }
me = meView{ID: u.ID, Email: u.Email, DisplayName: u.DisplayName, TOTP: u.TotpSecret != nil, ActiveOrg: sess.OrgID, Orgs: []orgView{}} me = meView{ID: u.ID, Email: u.Email, DisplayName: u.DisplayName, TOTP: u.TotpSecret != nil, ActiveOrg: sess.OrgID, Orgs: []orgView{}, RecoveryCodesLeft: int(left)}
for _, o := range orgs { for _, o := range orgs {
me.Orgs = append(me.Orgs, orgView{ID: o.ID, Slug: o.Slug, Name: o.Name, IsOwner: o.IsOwner, RequireTOTP: o.RequireTotp}) me.Orgs = append(me.Orgs, orgView{ID: o.ID, Slug: o.Slug, Name: o.Name, IsOwner: o.IsOwner, RequireTOTP: o.RequireTotp})
if o.RequireTotp && !me.TOTP { if o.RequireTotp && !me.TOTP {
@@ -154,32 +159,85 @@ func (s *Server) totpEnable(c *gin.Context) {
return return
} }
sealedSecret := s.keys.Seal([]byte(secret), sess.UserID[:]) sealedSecret := s.keys.Seal([]byte(secret), sess.UserID[:])
codes := auth.NewRecoveryCodes()
err = s.db.Tx(ctx, tenant.User(sess.UserID), func(q *store.Queries) error { err = s.db.Tx(ctx, tenant.User(sess.UserID), func(q *store.Queries) error {
return q.EnableTOTP(ctx, store.EnableTOTPParams{ID: sess.UserID, TotpSecret: sealedSecret}) if err := q.EnableTOTP(ctx, store.EnableTOTPParams{ID: sess.UserID, TotpSecret: sealedSecret}); err != nil {
return err
}
return replaceRecoveryCodes(ctx, q, sess.UserID, codes)
}) })
if err != nil { if err != nil {
internalError(c, err) internalError(c, err)
return return
} }
_ = s.rdb.Del(ctx, totpSetupKey(sess.UserID)).Err() _ = s.rdb.Del(ctx, totpSetupKey(sess.UserID)).Err()
c.Status(http.StatusNoContent) c.JSON(http.StatusOK, gin.H{"recovery_codes": codes})
} }
type totpDisableRequest struct { func replaceRecoveryCodes(ctx context.Context, q *store.Queries, user uuid.UUID, codes []string) error {
if err := q.DeleteRecoveryCodes(ctx, user); err != nil {
return err
}
rows := make([]store.InsertRecoveryCodesParams, len(codes))
for i, c := range codes {
rows[i] = store.InsertRecoveryCodesParams{UserID: user, CodeHash: auth.HashRecoveryCode(auth.NormalizeRecoveryCode(c))}
}
_, err := q.InsertRecoveryCodes(ctx, rows)
return err
}
// reauthRequest confirms a sensitive change with the password and a second
// factor, so a hijacked session alone cannot weaken the account.
type reauthRequest struct {
Password string `json:"password" binding:"required,max=1024"` Password string `json:"password" binding:"required,max=1024"`
Code string `json:"code" binding:"required,len=6,numeric"` Code string `json:"code" binding:"required,max=32"`
}
// reauthenticate checks req for the session user and writes the error
// response itself when it fails.
func (s *Server) reauthenticate(c *gin.Context, req reauthRequest) bool {
ctx := c.Request.Context()
sess := auth.Current(c)
if !s.limit(c, "reauth:"+sess.UserID.String(), 5, 15*time.Minute) {
return false
}
var user store.User
err := s.db.Tx(ctx, tenant.User(sess.UserID), func(q *store.Queries) error {
var err error
user, err = q.GetUser(ctx, sess.UserID)
return err
})
if err != nil {
internalError(c, err)
return false
}
if user.PasswordHash == nil {
fail(c, http.StatusConflict, "no_password")
return false
}
if ok, _, err := auth.VerifyPassword(*user.PasswordHash, req.Password); err != nil || !ok {
invalidCredentials(c)
return false
}
ok, err := s.verifySecondFactor(ctx, sess.UserID, req.Code)
if err != nil {
internalError(c, err)
return false
}
if !ok {
fail(c, http.StatusUnauthorized, "invalid_code")
return false
}
return true
} }
func (s *Server) totpDisable(c *gin.Context) { func (s *Server) totpDisable(c *gin.Context) {
var req totpDisableRequest var req reauthRequest
if !bind(c, &req) { if !bind(c, &req) {
return return
} }
ctx := c.Request.Context() ctx := c.Request.Context()
sess := auth.Current(c) sess := auth.Current(c)
if !s.limit(c, "totp_disable:"+sess.UserID.String(), 5, 15*time.Minute) {
return
}
me, err := s.loadMe(ctx, sess) me, err := s.loadMe(ctx, sess)
if err != nil { if err != nil {
internalError(c, err) internalError(c, err)
@@ -191,33 +249,14 @@ func (s *Server) totpDisable(c *gin.Context) {
return return
} }
} }
var user store.User if !s.reauthenticate(c, req) {
return
}
err = s.db.Tx(ctx, tenant.User(sess.UserID), func(q *store.Queries) error { err = s.db.Tx(ctx, tenant.User(sess.UserID), func(q *store.Queries) error {
var err error if err := q.DisableTOTP(ctx, sess.UserID); err != nil {
user, err = q.GetUser(ctx, sess.UserID)
return err return err
})
if err != nil {
internalError(c, err)
return
} }
if user.PasswordHash == nil { return q.DeleteRecoveryCodes(ctx, sess.UserID)
fail(c, http.StatusConflict, "no_password")
return
}
if ok, _, err := auth.VerifyPassword(*user.PasswordHash, req.Password); err != nil || !ok {
invalidCredentials(c)
return
}
if ok, err := s.verifyUserTOTP(ctx, sess.UserID, req.Code); err != nil {
internalError(c, err)
return
} else if !ok {
fail(c, http.StatusUnauthorized, "invalid_code")
return
}
err = s.db.Tx(ctx, tenant.User(sess.UserID), func(q *store.Queries) error {
return q.DisableTOTP(ctx, sess.UserID)
}) })
if err != nil { if err != nil {
internalError(c, err) internalError(c, err)
@@ -226,9 +265,38 @@ func (s *Server) totpDisable(c *gin.Context) {
c.Status(http.StatusNoContent) c.Status(http.StatusNoContent)
} }
func (s *Server) regenerateRecoveryCodes(c *gin.Context) {
var req reauthRequest
if !bind(c, &req) || !s.reauthenticate(c, req) {
return
}
ctx := c.Request.Context()
sess := auth.Current(c)
codes := auth.NewRecoveryCodes()
err := s.db.Tx(ctx, tenant.User(sess.UserID), func(q *store.Queries) error {
return replaceRecoveryCodes(ctx, q, sess.UserID, codes)
})
if err != nil {
internalError(c, err)
return
}
c.JSON(http.StatusOK, gin.H{"recovery_codes": codes})
}
var errNoTOTP = errors.New("api: user has no totp") var errNoTOTP = errors.New("api: user has no totp")
func (s *Server) verifyUserTOTP(ctx context.Context, userID uuid.UUID, code string) (bool, error) { // verifySecondFactor accepts a current TOTP code or an unused recovery code,
// which is consumed.
func (s *Server) verifySecondFactor(ctx context.Context, userID uuid.UUID, code string) (bool, error) {
if rc := auth.NormalizeRecoveryCode(code); rc != "" {
var n int64
err := s.db.Tx(ctx, tenant.User(userID), func(q *store.Queries) error {
var err error
n, err = q.UseRecoveryCode(ctx, store.UseRecoveryCodeParams{UserID: userID, CodeHash: auth.HashRecoveryCode(rc)})
return err
})
return n == 1, err
}
var user store.User var user store.User
err := s.db.Tx(ctx, tenant.User(userID), func(q *store.Queries) error { err := s.db.Tx(ctx, tenant.User(userID), func(q *store.Queries) error {
var err error var err error
+1
View File
@@ -170,6 +170,7 @@ func toWebMe(m meView) web.Me {
TOTP: m.TOTP, TOTP: m.TOTP,
ActiveOrg: m.ActiveOrg.String(), ActiveOrg: m.ActiveOrg.String(),
TOTPMissing: m.TOTPEnrollmentRequired, TOTPMissing: m.TOTPEnrollmentRequired,
RecoveryCodesLeft: m.RecoveryCodesLeft,
} }
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})
+87
View File
@@ -0,0 +1,87 @@
package api_test
import (
"net/http"
"testing"
"time"
"github.com/pquerna/otp/totp"
)
// enableTOTP turns on TOTP for b and returns the secret and recovery codes.
func (b *browser) enableTOTP() (string, []string) {
b.t.Helper()
st, setup := b.do("POST", "/api/v1/me/totp/setup", nil)
if st != http.StatusOK {
b.t.Fatalf("totp setup = %d %v", st, setup)
}
secret := setup["secret"].(string)
code, _ := totp.GenerateCode(secret, time.Now())
st, body := b.do("POST", "/api/v1/me/totp/enable", map[string]any{"code": code})
if st != http.StatusOK {
b.t.Fatalf("totp enable = %d %v", st, body)
}
var codes []string
for _, c := range body["recovery_codes"].([]any) {
codes = append(codes, c.(string))
}
return secret, codes
}
func TestRecoveryCodes(t *testing.T) {
e := newEnv(t)
email := uniq("r") + "@example.test"
owner := e.browser(t)
owner.signup(email, uniq("rec-"))
_, codes := owner.enableTOTP()
if len(codes) != 10 {
t.Fatalf("enable returned %d recovery codes, want 10", len(codes))
}
login := func(code string) (int, map[string]any) {
b := e.browser(t)
if st, body := b.do("POST", "/api/v1/auth/login", map[string]any{"email": email, "password": "correct horse battery"}); body["status"] != "totp_required" {
t.Fatalf("login = %d %v, want totp_required", st, body)
}
return b.do("POST", "/api/v1/auth/login/totp", map[string]any{"code": code})
}
if st, body := login(codes[0]); st != http.StatusOK {
t.Fatalf("login with recovery code = %d %v, want 200", st, body)
}
if st, _ := login(codes[0]); st != http.StatusUnauthorized {
t.Errorf("login with used recovery code = %d, want 401", st)
}
if st, _ := login(" " + upper(codes[1][:5]) + " " + codes[1][6:]); st != http.StatusOK {
t.Errorf("login with reformatted recovery code = %d, want 200", st)
}
if _, me := owner.do("GET", "/api/v1/me", nil); me["recovery_codes_left"] != float64(8) {
t.Errorf("recovery_codes_left = %v, want 8", me["recovery_codes_left"])
}
st, body := owner.do("POST", "/api/v1/me/totp/recovery-codes", map[string]any{"password": "correct horse battery", "code": codes[2]})
if st != http.StatusOK || len(body["recovery_codes"].([]any)) != 10 {
t.Fatalf("regenerate = %d %v, want 200 with 10 codes", st, body)
}
if st, _ := login(codes[3]); st != http.StatusUnauthorized {
t.Errorf("login with code from replaced set = %d, want 401", st)
}
if st, _ := login(body["recovery_codes"].([]any)[0].(string)); st != http.StatusOK {
t.Errorf("login with code from new set = %d, want 200", st)
}
st, _ = owner.do("POST", "/api/v1/me/totp/recovery-codes", map[string]any{"password": "wrong password!!", "code": codes[4]})
if st != http.StatusUnauthorized {
t.Errorf("regenerate with wrong password = %d, want 401", st)
}
}
func upper(s string) string {
b := []byte(s)
for i, c := range b {
if c >= 'a' && c <= 'z' {
b[i] = c - 32
}
}
return string(b)
}
+1
View File
@@ -83,6 +83,7 @@ func (s *Server) Mount(r gin.IRouter) {
me.POST("/totp/setup", s.totpSetup) me.POST("/totp/setup", s.totpSetup)
me.POST("/totp/enable", s.totpEnable) me.POST("/totp/enable", s.totpEnable)
me.POST("/totp/disable", s.totpDisable) me.POST("/totp/disable", s.totpDisable)
me.POST("/totp/recovery-codes", s.regenerateRecoveryCodes)
org := v1.Group("/org", auth.Require(), s.requireOwner()) org := v1.Group("/org", auth.Require(), s.requireOwner())
org.GET("/sso", s.listSSOProviders) org.GET("/sso", s.listSSOProviders)
+5
View File
@@ -57,6 +57,11 @@ func newEnv(t *testing.T) *env {
} }
rdb := redis.NewClient(opts) rdb := redis.NewClient(opts)
t.Cleanup(func() { _ = rdb.Close() }) t.Cleanup(func() { _ = rdb.Close() })
// UPTIME_TEST_REDIS_URL must name a database reserved for tests; clearing
// it resets rate limits left over from earlier runs.
if err := rdb.FlushDB(ctx).Err(); err != nil {
t.Fatalf("FLUSHDB failed: %v", err)
}
key := make([]byte, 32) key := make([]byte, 32)
_, _ = rand.Read(key) _, _ = rand.Read(key)
+5
View File
@@ -149,6 +149,11 @@ func TestT(t *testing.T) {
if got, want := T(ctx, "error.password_too_short", "Min", 12), "Das Passwort braucht mindestens 12 Zeichen."; got != want { if got, want := T(ctx, "error.password_too_short", "Min", 12), "Das Passwort braucht mindestens 12 Zeichen."; got != want {
t.Errorf("T(de, password_too_short) = %q, want %q", got, want) t.Errorf("T(de, password_too_short) = %q, want %q", got, want)
} }
for n, want := range map[int]string{1: "1 Wiederherstellungscode übrig", 3: "3 Wiederherstellungscodes übrig"} {
if got := T(ctx, "security.recovery.left", "Count", n); got != want {
t.Errorf("T(de, recovery.left, %d) = %q, want %q", n, got, want)
}
}
if got, want := T(ctx, "no.such.key"), "no.such.key"; got != want { if got, want := T(ctx, "no.such.key"), "no.such.key"; got != want {
t.Errorf("T(missing) = %q, want %q", got, want) t.Errorf("T(missing) = %q, want %q", got, want)
} }
+9 -2
View File
@@ -11,7 +11,7 @@
"auth.login.submit": "Weiter", "auth.login.submit": "Weiter",
"auth.login.title": "Anmelden", "auth.login.title": "Anmelden",
"auth.login.to_signup": "Registrieren", "auth.login.to_signup": "Registrieren",
"auth.login.totp_hint": "Code aus der Authenticator-App eingeben.", "auth.login.totp_hint": "Code aus der Authenticator-App oder einen Wiederherstellungscode eingeben.",
"auth.signup.submit": "Anlegen", "auth.signup.submit": "Anlegen",
"auth.signup.title": "Konto anlegen", "auth.signup.title": "Konto anlegen",
"auth.signup.to_login": "Zur Anmeldung", "auth.signup.to_login": "Zur Anmeldung",
@@ -61,6 +61,13 @@
"error.unsupported_locale": "Sprache wird nicht unterstützt.", "error.unsupported_locale": "Sprache wird nicht unterstützt.",
"lang.de": "Deutsch", "lang.de": "Deutsch",
"lang.en": "English", "lang.en": "English",
"security.recovery.left": {
"one": "{{.Count}} Wiederherstellungscode übrig",
"other": "{{.Count}} Wiederherstellungscodes übrig"
},
"security.recovery.regenerate": "Neue Wiederherstellungscodes erzeugen",
"security.recovery.save_now": "Bewahre diese Wiederherstellungscodes sicher auf. Jeder funktioniert einmal, falls du deinen Authenticator verlierst. Sie werden nicht erneut angezeigt.",
"security.recovery.saved": "Ich habe sie gespeichert",
"security.sso.heading": "Single Sign-on", "security.sso.heading": "Single Sign-on",
"security.sso.link": "SSO-Anmeldung verknüpfen", "security.sso.link": "SSO-Anmeldung verknüpfen",
"security.sso.linked": "SSO-Anmeldung verknüpft.", "security.sso.linked": "SSO-Anmeldung verknüpft.",
@@ -69,7 +76,7 @@
"security.totp.active": "aktiv", "security.totp.active": "aktiv",
"security.totp.app_code": "Code aus der App", "security.totp.app_code": "Code aus der App",
"security.totp.confirm": "Bestätigen", "security.totp.confirm": "Bestätigen",
"security.totp.current_code": "Aktueller Code", "security.totp.current_code": "Aktueller Code oder Wiederherstellungscode",
"security.totp.disable": "Deaktivieren", "security.totp.disable": "Deaktivieren",
"security.totp.heading": "Zwei-Faktor (TOTP)", "security.totp.heading": "Zwei-Faktor (TOTP)",
"security.totp.inactive": "nicht eingerichtet", "security.totp.inactive": "nicht eingerichtet",
+9 -2
View File
@@ -11,7 +11,7 @@
"auth.login.submit": "Continue", "auth.login.submit": "Continue",
"auth.login.title": "Sign in", "auth.login.title": "Sign in",
"auth.login.to_signup": "Sign up", "auth.login.to_signup": "Sign up",
"auth.login.totp_hint": "Enter the code from your authenticator app.", "auth.login.totp_hint": "Enter the code from your authenticator app or one of your recovery codes.",
"auth.signup.submit": "Create", "auth.signup.submit": "Create",
"auth.signup.title": "Create account", "auth.signup.title": "Create account",
"auth.signup.to_login": "Back to sign in", "auth.signup.to_login": "Back to sign in",
@@ -61,6 +61,13 @@
"error.unsupported_locale": "Unsupported language.", "error.unsupported_locale": "Unsupported language.",
"lang.de": "Deutsch", "lang.de": "Deutsch",
"lang.en": "English", "lang.en": "English",
"security.recovery.left": {
"one": "{{.Count}} recovery code left",
"other": "{{.Count}} recovery codes left"
},
"security.recovery.regenerate": "Generate new recovery codes",
"security.recovery.save_now": "Store these recovery codes somewhere safe. Each works once if you lose your authenticator. They will not be shown again.",
"security.recovery.saved": "I have saved them",
"security.sso.heading": "Single sign-on", "security.sso.heading": "Single sign-on",
"security.sso.link": "Link SSO sign-in", "security.sso.link": "Link SSO sign-in",
"security.sso.linked": "SSO sign-in linked.", "security.sso.linked": "SSO sign-in linked.",
@@ -69,7 +76,7 @@
"security.totp.active": "active", "security.totp.active": "active",
"security.totp.app_code": "Code from the app", "security.totp.app_code": "Code from the app",
"security.totp.confirm": "Confirm", "security.totp.confirm": "Confirm",
"security.totp.current_code": "Current code", "security.totp.current_code": "Current code or recovery code",
"security.totp.disable": "Disable", "security.totp.disable": "Disable",
"security.totp.heading": "Two-factor (TOTP)", "security.totp.heading": "Two-factor (TOTP)",
"security.totp.inactive": "not set up", "security.totp.inactive": "not set up",
+10
View File
@@ -44,6 +44,16 @@
button && (button.disabled = true); button && (button.disabled = true);
try { try {
const res = await api.request({ method: form.dataset.method || "post", url, data: body }); const res = await api.request({ method: form.dataset.method || "post", url, data: body });
if (form.dataset.showCodes !== undefined && res.data?.recovery_codes) {
const out = form.querySelector("[data-recovery-output]");
const list = out.querySelector("[data-recovery-list]");
list.replaceChildren(
...res.data.recovery_codes.map((c) => Object.assign(document.createElement("li"), { textContent: c })),
);
for (const el of form.elements) el.disabled = true;
out.hidden = false;
return;
}
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;
+32 -3
View File
@@ -13,6 +13,8 @@ type Me struct {
ActiveOrg string ActiveOrg string
Orgs []Org Orgs []Org
TOTPMissing bool TOTPMissing bool
// RecoveryCodesLeft counts unused TOTP recovery codes.
RecoveryCodesLeft int
} }
// Org is one entry of the organization switcher. // Org is one entry of the organization switcher.
@@ -81,13 +83,29 @@ templ Security(p Page, me Me, identities []Identity, canLink bool) {
<section class="max-w-md"> <section class="max-w-md">
<h2 class="mb-1 text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "security.totp.heading") }</h2> <h2 class="mb-1 text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "security.totp.heading") }</h2>
if me.TOTP { if me.TOTP {
<p class="mb-6 text-sm"><span class="text-up">●</span> { i18n.T(ctx, "security.totp.active") }</p> <p class="mb-1 text-sm"><span class="text-up">●</span> { i18n.T(ctx, "security.totp.active") }</p>
<form data-api="/me/totp/disable" data-next="/settings/security"> <p class={ "mb-6 text-sm", templ.KV("text-down", me.RecoveryCodesLeft < 3), templ.KV("text-muted", me.RecoveryCodesLeft >= 3) }>
{ i18n.T(ctx, "security.recovery.left", "Count", me.RecoveryCodesLeft) }
</p>
<details class="mb-6">
<summary class="cursor-pointer text-sm text-muted hover:text-ink">{ i18n.T(ctx, "security.recovery.regenerate") }</summary>
<form data-api="/me/totp/recovery-codes" data-show-codes class="mt-4">
@formError()
@field(i18n.T(ctx, "auth.field.password"), "password", "password", "current-password", true)
@field(i18n.T(ctx, "security.totp.current_code"), "code", "text", "one-time-code", true)
@submit(i18n.T(ctx, "security.recovery.regenerate"))
@recoveryOutput()
</form>
</details>
<details>
<summary class="cursor-pointer text-sm text-muted hover:text-ink">{ i18n.T(ctx, "security.totp.disable") }</summary>
<form data-api="/me/totp/disable" data-next="/settings/security" class="mt-4">
@formError() @formError()
@field(i18n.T(ctx, "auth.field.password"), "password", "password", "current-password", true) @field(i18n.T(ctx, "auth.field.password"), "password", "password", "current-password", true)
@field(i18n.T(ctx, "security.totp.current_code"), "code", "text", "one-time-code", true) @field(i18n.T(ctx, "security.totp.current_code"), "code", "text", "one-time-code", true)
@submit(i18n.T(ctx, "security.totp.disable")) @submit(i18n.T(ctx, "security.totp.disable"))
</form> </form>
</details>
} else { } else {
<p class="mb-6 text-sm"><span class="text-unknown">●</span> { i18n.T(ctx, "security.totp.inactive") }</p> <p class="mb-6 text-sm"><span class="text-unknown">●</span> { i18n.T(ctx, "security.totp.inactive") }</p>
<div data-totp-setup> <div data-totp-setup>
@@ -95,10 +113,11 @@ templ Security(p Page, me Me, identities []Identity, canLink bool) {
<div data-totp-panel hidden> <div data-totp-panel hidden>
<img data-totp-qr alt={ i18n.T(ctx, "security.totp.qr_alt") } class="mb-3 h-48 w-48 border border-rule bg-white p-2"/> <img data-totp-qr alt={ i18n.T(ctx, "security.totp.qr_alt") } 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> <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"> <form data-api="/me/totp/enable" data-show-codes>
@formError() @formError()
@field(i18n.T(ctx, "security.totp.app_code"), "code", "text", "one-time-code", true) @field(i18n.T(ctx, "security.totp.app_code"), "code", "text", "one-time-code", true)
@submit(i18n.T(ctx, "security.totp.confirm")) @submit(i18n.T(ctx, "security.totp.confirm"))
@recoveryOutput()
</form> </form>
</div> </div>
</div> </div>
@@ -121,3 +140,13 @@ templ Security(p Page, me Me, identities []Identity, canLink bool) {
</section> </section>
} }
} }
// recoveryOutput is filled by app.js with codes returned by the API; they
// are shown once and never rendered by the server.
templ recoveryOutput() {
<div data-recovery-output hidden class="mt-6 border border-ink p-4">
<p class="mb-3 text-sm">{ i18n.T(ctx, "security.recovery.save_now") }</p>
<ol data-recovery-list class="mb-4 grid grid-cols-2 gap-x-6 gap-y-1 font-mono text-sm"></ol>
<a href="/settings/security" class="text-sm underline underline-offset-2">{ i18n.T(ctx, "security.recovery.saved") }</a>
</div>
}
+291 -129
View File
@@ -22,6 +22,8 @@ type Me struct {
ActiveOrg string ActiveOrg string
Orgs []Org Orgs []Org
TOTPMissing bool TOTPMissing bool
// RecoveryCodesLeft counts unused TOTP recovery codes.
RecoveryCodesLeft int
} }
// Org is one entry of the organization switcher. // Org is one entry of the organization switcher.
@@ -79,7 +81,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: 34, Col: 27} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 36, 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 {
@@ -102,7 +104,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: 34, Col: 73} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 36, 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 {
@@ -125,7 +127,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: 38, Col: 47} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 40, 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 {
@@ -148,7 +150,7 @@ func consoleShell(p Page, me Me) templ.Component {
var templ_7745c5c3_Var6 string var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.sso")) templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.sso"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 42, Col: 96} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 44, Col: 96}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -166,7 +168,7 @@ func consoleShell(p Page, me Me) templ.Component {
var templ_7745c5c3_Var7 string var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.security")) 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: 44, Col: 105} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 46, 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 {
@@ -179,7 +181,7 @@ func consoleShell(p Page, me Me) templ.Component {
var templ_7745c5c3_Var8 string var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout")) templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 45, Col: 94} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 47, Col: 94}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -205,7 +207,7 @@ func consoleShell(p Page, me Me) templ.Component {
var templ_7745c5c3_Var9 string var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.totp_missing")) 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: 53, Col: 42} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 55, 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 {
@@ -218,7 +220,7 @@ func consoleShell(p Page, me Me) templ.Component {
var templ_7745c5c3_Var10 string var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.totp_missing_action")) templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.totp_missing_action"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 54, Col: 115} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 56, Col: 115}
} }
_, 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 {
@@ -291,7 +293,7 @@ func Dashboard(p Page, me Me) templ.Component {
var templ_7745c5c3_Var13 string var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title")) 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: 67, Col: 75} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 69, 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 {
@@ -304,7 +306,7 @@ func Dashboard(p Page, me Me) templ.Component {
var templ_7745c5c3_Var14 string var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.empty")) templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.empty"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 68, Col: 76} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 70, Col: 76}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -366,7 +368,7 @@ func Security(p Page, me Me, identities []Identity, canLink bool) templ.Componen
var templ_7745c5c3_Var17 string var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.title")) 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: 80, Col: 72} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 82, 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 {
@@ -379,7 +381,7 @@ func Security(p Page, me Me, identities []Identity, canLink bool) templ.Componen
var templ_7745c5c3_Var18 string var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.heading")) templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.heading"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 82, Col: 114} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 84, Col: 114}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@@ -390,20 +392,123 @@ func Security(p Page, me Me, identities []Identity, canLink bool) templ.Componen
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
if me.TOTP { if me.TOTP {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "<p class=\"mb-6 text-sm\"><span class=\"text-up\">●</span> ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "<p class=\"mb-1 text-sm\"><span class=\"text-up\">●</span> ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var19 string var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, 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: 84, Col: 98} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 86, Col: 98}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_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, 30, "</p><form data-api=\"/me/totp/disable\" data-next=\"/settings/security\">") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "</p>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
{
templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer
templ_7745c5c3_Buffer := templ.GetBuffer()
var templ_7745c5c3_ElementScripts []templ.ComponentScript
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "<p class=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var20 = []any{"mb-6 text-sm", templ.KV("text-down", me.RecoveryCodesLeft < 3), templ.KV("text-muted", me.RecoveryCodesLeft >= 3)}
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var20...)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var21 string
templ_7745c5c3_Var21, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.CSSClasses(templ_7745c5c3_Var20).String()).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 1, Col: 0}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var21)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_ElementScripts...)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_ElementWriter)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ.ReleaseBuffer(templ_7745c5c3_Buffer)
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, ">")
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, "security.recovery.left", "Count", me.RecoveryCodesLeft))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 88, Col: 75}
}
_, 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, 34, "</p><details class=\"mb-6\"><summary class=\"cursor-pointer text-sm text-muted hover:text-ink\">")
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.recovery.regenerate"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 91, Col: 116}
}
_, 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, 35, "</summary><form data-api=\"/me/totp/recovery-codes\" data-show-codes class=\"mt-4\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = formError().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = field(i18n.T(ctx, "auth.field.password"), "password", "password", "current-password", true).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = field(i18n.T(ctx, "security.totp.current_code"), "code", "text", "one-time-code", true).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = submit(i18n.T(ctx, "security.recovery.regenerate")).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = recoveryOutput().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "</form></details> <details><summary class=\"cursor-pointer text-sm text-muted hover:text-ink\">")
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.totp.disable"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 101, 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, 37, "</summary><form data-api=\"/me/totp/disable\" data-next=\"/settings/security\" class=\"mt-4\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@@ -423,51 +528,51 @@ func Security(p Page, me Me, identities []Identity, canLink bool) templ.Componen
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, "</form>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "</form></details>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} else { } else {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "<p class=\"mb-6 text-sm\"><span class=\"text-unknown\">●</span> ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "<p class=\"mb-6 text-sm\"><span class=\"text-unknown\">●</span> ")
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_Var25 string
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.inactive")) templ_7745c5c3_Var25, 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: 92, Col: 105} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 110, 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_Var25))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 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\">") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "</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_Var26 string
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.start")) templ_7745c5c3_Var26, 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: 94, Col: 141} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 112, Col: 141}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "</button><div data-totp-panel hidden><img data-totp-qr alt=\"") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "</button><div data-totp-panel hidden><img data-totp-qr alt=\"")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var22 string var templ_7745c5c3_Var27 string
templ_7745c5c3_Var22, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "security.totp.qr_alt")).Resolve(ctx) templ_7745c5c3_Var27, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "security.totp.qr_alt")).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: 96, Col: 65} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 114, Col: 65}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var22) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var27)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 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\">") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "\" class=\"mb-3 h-48 w-48 border border-rule bg-white p-2\"><p class=\"mb-6 break-all font-mono text-xs text-muted\" data-totp-secret></p><form data-api=\"/me/totp/enable\" data-show-codes>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@@ -483,121 +588,125 @@ func Security(p Page, me Me, identities []Identity, canLink bool) templ.Componen
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, 36, "</form></div></div>") templ_7745c5c3_Err = recoveryOutput().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "</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, 37, "</section><section class=\"mt-12 max-w-md\"><h2 class=\"mb-3 text-xs font-medium uppercase tracking-wider text-muted\">") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "</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 { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var28 string var templ_7745c5c3_Var28 string
templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.link")) templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.heading"))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 119, Col: 190} return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 127, Col: 113}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "</a>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "</h2>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if len(identities) == 0 {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "<p class=\"mb-4 text-sm text-muted\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var29 string
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.none"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 129, Col: 73}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "</p>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "<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, 49, "<li class=\"flex justify-between gap-4 py-2\"><span>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var30 string
templ_7745c5c3_Var30, 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: 133, Col: 69}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "</span><span class=\"font-mono text-xs text-muted\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var31 string
templ_7745c5c3_Var31, 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: 133, Col: 131}
}
_, 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, 51, "</span></li>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "</section>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "</ul>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if canLink {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "<a href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var32 string
templ_7745c5c3_Var32, 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: 138, Col: 64}
}
_, 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, 54, "\" 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_Var33 string
templ_7745c5c3_Var33, 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: 138, Col: 190}
}
_, 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, 55, "</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "</section>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@@ -611,4 +720,57 @@ func Security(p Page, me Me, identities []Identity, canLink bool) templ.Componen
}) })
} }
// recoveryOutput is filled by app.js with codes returned by the API; they
// are shown once and never rendered by the server.
func recoveryOutput() 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, 57, "<div data-recovery-output hidden class=\"mt-6 border border-ink p-4\"><p class=\"mb-3 text-sm\">")
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, "security.recovery.save_now"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 148, Col: 69}
}
_, 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, 58, "</p><ol data-recovery-list class=\"mb-4 grid grid-cols-2 gap-x-6 gap-y-1 font-mono text-sm\"></ol><a href=\"/settings/security\" class=\"text-sm underline underline-offset-2\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var36 string
templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.saved"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 150, Col: 116}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "</a></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate var _ = templruntime.GeneratedTemplate