From 740fa4a5d297a214828a8952bfb720219654c31e Mon Sep 17 00:00:00 2001 From: Krish Mamtora Date: Mon, 27 May 2024 08:32:45 -0400 Subject: [PATCH] Add missing properties when reloading page after error --- internal/ui/settings_update.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/ui/settings_update.go b/internal/ui/settings_update.go index fceec0dc..e84cd1ff 100644 --- a/internal/ui/settings_update.go +++ b/internal/ui/settings_update.go @@ -30,6 +30,12 @@ func (h *handler) updateSettings(w http.ResponseWriter, r *http.Request) { return } + creds, err := h.store.WebAuthnCredentialsByUserID(loggedUser.ID) + if err != nil { + html.ServerError(w, r, err) + return + } + settingsForm := form.NewSettingsForm(r) sess := session.New(h.store, request.SessionID(r)) @@ -42,6 +48,10 @@ func (h *handler) updateSettings(w http.ResponseWriter, r *http.Request) { view.Set("user", loggedUser) view.Set("countUnread", h.store.CountUnreadEntries(loggedUser.ID)) view.Set("countErrorFeeds", h.store.CountUserFeedsWithErrors(loggedUser.ID)) + view.Set("default_home_pages", model.HomePages()) + view.Set("categories_sorting_options", model.CategoriesSortingOptions()) + view.Set("countWebAuthnCerts", h.store.CountWebAuthnCredentialsByUserID(loggedUser.ID)) + view.Set("webAuthnCerts", creds) if validationErr := settingsForm.Validate(); validationErr != nil { view.Set("errorMessage", validationErr.Translate(loggedUser.Language))