Documentation
¶
Overview ¶
Package templates compiles and renders web page and email templates.
Index ¶
- func Validate(dir string) error
- type ConnectorData
- type ConsentData
- type EmailData
- type ErrorData
- type GrantData
- type GrantsData
- type IdentityData
- type Manager
- func (m *Manager) HandlePublic(w http.ResponseWriter, r *http.Request, pageData PageData)
- func (m *Manager) RenderEmail(w io.Writer, format string, data OTPEmailData) error
- func (m *Manager) RenderEmailSubject(data OTPEmailData) (string, error)
- func (m *Manager) RenderPage(w io.Writer, name string, data any) error
- type OTPData
- type OTPEmailData
- type PageData
- type RequestData
- type SelectorData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnectorData ¶
ConnectorData describes a sign-in option rendered by the selector.
type ConsentData ¶
ConsentData supplies data to the offline-access consent template.
type GrantData ¶
type GrantData struct {
SID, ClientID, Mode, ActionToken, Email string
CreatedAt, LastUsedAt, ExpiresAt time.Time
}
GrantData describes one active grant and its one-use revocation action.
type GrantsData ¶
GrantsData supplies the self-service grant management page.
type IdentityData ¶
IdentityData supplies data to the identity selection template.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns the compiled page and email templates.
func Load ¶
Load compiles each page with the effective common layout and test-renders all templates.
func (*Manager) HandlePublic ¶
HandlePublic serves public files and renders the error template for unmatched paths.
func (*Manager) RenderEmail ¶
RenderEmail renders an OTP email in the requested format.
func (*Manager) RenderEmailSubject ¶
func (m *Manager) RenderEmailSubject(data OTPEmailData) (string, error)
RenderEmailSubject renders and validates an OTP email subject.
type OTPData ¶
type OTPData struct {
PageData
Title, ChallengeID, Message, Error, Email string
ExpiresIn, RetryAfter time.Duration
ExpiresAt time.Time
RetryAfterSeconds int64
}
OTPData supplies data to the OTP entry template.
type OTPEmailData ¶
OTPEmailData supplies data to OTP email templates.
type PageData ¶
type PageData struct {
Request RequestData
IssuerURL string
HomepageURL string
}
PageData supplies common, non-sensitive context to browser page templates.
type RequestData ¶
type RequestData struct{ Method, Host, Path string }
RequestData supplies non-sensitive request metadata to browser page templates.
type SelectorData ¶
type SelectorData struct {
PageData
Title string
Screen string
State string
SiteKey string
Connectors []ConnectorData
}
SelectorData supplies data to the sign-in selector template.