summaryrefslogtreecommitdiff
path: root/pkg/webui/login.go
diff options
context:
space:
mode:
authorJulien Dessaux2025-01-30 00:19:16 +0100
committerJulien Dessaux2025-01-30 00:19:16 +0100
commit98c7d6f5785182117b9fe6ebd6b892f860bc2024 (patch)
tree261f22399f8f3fce71a2e1c4fc79314c2a8c5efd /pkg/webui/login.go
parentfix(webui): fix invalid session cookie handling (diff)
downloadtfstated-98c7d6f5785182117b9fe6ebd6b892f860bc2024.tar.gz
tfstated-98c7d6f5785182117b9fe6ebd6b892f860bc2024.tar.bz2
tfstated-98c7d6f5785182117b9fe6ebd6b892f860bc2024.zip
feat(webui): bootstrap account settings management with light and dark mode
Diffstat (limited to '')
-rw-r--r--pkg/webui/login.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/webui/login.go b/pkg/webui/login.go
index 6f688c1..18864b2 100644
--- a/pkg/webui/login.go
+++ b/pkg/webui/login.go
@@ -2,8 +2,10 @@ package webui
import (
"context"
+ "encoding/json"
"fmt"
"html/template"
+ "log/slog"
"net/http"
"regexp"
@@ -113,6 +115,11 @@ func loginMiddleware(db *database.DB, requireSession func(http.Handler) http.Han
return
}
ctx := context.WithValue(r.Context(), model.AccountContextKey{}, account)
+ var settings model.Settings
+ if err := json.Unmarshal(account.Settings, &settings); err != nil {
+ slog.Error("failed to unmarshal account settings", "err", err, "accountId", account.Id)
+ }
+ ctx = context.WithValue(ctx, model.SettingsContextKey{}, &settings)
next.ServeHTTP(w, r.WithContext(ctx))
}))
}