parent
895615ad6e
commit
5d7b540718
15 changed files with 71 additions and 2 deletions
|
@ -16,7 +16,7 @@ type SettingsPage struct {
|
|||
|
||||
var settingsTemplates = template.Must(template.ParseFS(htmlFS, "html/base.html", "html/settings.html"))
|
||||
|
||||
func handleSettingsGET(db *database.DB) http.Handler {
|
||||
func handleSettingsGET() http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
render(w, settingsTemplates, http.StatusOK, SettingsPage{
|
||||
Page: makePage(r, &Page{Title: "Settings", Section: "settings"}),
|
||||
|
@ -30,6 +30,9 @@ func handleSettingsPOST(db *database.DB) http.Handler {
|
|||
errorResponse(w, r, http.StatusBadRequest, err)
|
||||
return
|
||||
}
|
||||
if !verifyCSRFToken(w, r) {
|
||||
return
|
||||
}
|
||||
darkMode := r.FormValue("dark-mode")
|
||||
settings := model.Settings{
|
||||
LightMode: darkMode != "1",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue