From e85a4aefa2dedafc9e980b30139e695142b137d2 Mon Sep 17 00:00:00 2001 From: Amir Raminfar Date: Mon, 30 Oct 2023 12:20:00 -0700 Subject: [PATCH] feat: adds support for user.yml from disk (#2455) --- assets/pages/index.vue | 15 +++- assets/pages/login.vue | 5 +- assets/stores/config.ts | 1 + go.mod | 11 +++ go.sum | 47 +++++++++++++ internal/auth/proxy.go | 32 +++------ internal/auth/simple.go | 49 +++++++++++++ internal/auth/users.go | 116 +++++++++++++++++++++++++++++++ internal/web/auth.go | 34 +++++++++ internal/web/index.go | 36 +++++----- internal/web/profile.go | 2 +- internal/web/routes.go | 29 ++++++-- internal/web/routes_auth_test.go | 4 +- internal/web/routes_test.go | 2 +- main.go | 21 +++++- 15 files changed, 348 insertions(+), 56 deletions(-) create mode 100644 internal/auth/simple.go create mode 100644 internal/auth/users.go diff --git a/assets/pages/index.vue b/assets/pages/index.vue index e5588d42..1d98b387 100644 --- a/assets/pages/index.vue +++ b/assets/pages/index.vue @@ -2,8 +2,11 @@
-
- {{ config.user?.email }} +
+ +
+
+ {{ config.user.name ?? config.user.email }}
@@ -73,6 +76,14 @@ watchEffect(() => { setTitle(t("title.dashboard", { count: runningContainers.length })); } }); + +async function logout() { + await fetch(withBase("/api/token"), { + method: "DELETE", + }); + + location.reload(); +}