Documentation
¶
Overview ¶
Package settings holds the Githome web front's account settings handlers. The account settings tree lives under /settings and is gated to the signed-in viewer: it administers the viewer's own account, so an anonymous request gets the same 404 as any page that is not there, never a sign-in wall that confirms the surface exists. Githome backs one account section today, the appearance preference, since the color mode and themes ride cookies the color-mode middleware already reads; the unbacked sections (profile, emails, keys, tokens, sessions, security) get no nav entry rather than a dead link, the same honest absence the profile took for its unbacked tabs. Every mutation posts and redirects, so the no-JS flow lands on a clean GET, and the CSRF guard the page chain installs verifies each post. See implementation/13.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deps ¶
Deps are the account settings handlers' dependencies: the render set, the view builder for the shell chrome, the flash store for the one-shot outcome notice a save reports after its redirect, and a logger.
type Flasher ¶
Flasher is the slice of the flash store the settings handlers use: stage a one-shot message to show on the page the redirect lands on. The webmw.Flash satisfies it; the narrow interface keeps the handler testable without a cookie round-trip.
type Handlers ¶
type Handlers struct {
// contains filtered or unexported fields
}
Handlers is the account settings handler set. One is built at boot and shared; it holds no per-request state.
func (*Handlers) Appearance ¶
Appearance renders the appearance form, prefilled from the color mode the middleware resolved for this request, so the form opens showing the viewer's current choice rather than a default.
func (*Handlers) Index ¶
Index redirects the bare /settings root to the first backed section. A bookmark of /settings keeps working as Githome adds sections, always landing on a real page rather than a blank index.
func (*Handlers) SaveAppearance ¶
SaveAppearance validates the submitted mode and themes against the closed catalogs the form offered, writes the three cookies, and redirects back to the form with a flash. The form can only present valid values, so a value outside the catalogs is a forged post: it is rejected with an error flash and no cookie is written, rather than poisoning the preference with a theme that does not exist.