From dbdd38694d9d38d54eb621e5f976f2852e2e7c43 Mon Sep 17 00:00:00 2001 From: Thomas Miceli Date: Sun, 16 Apr 2023 17:48:21 +0200 Subject: [PATCH] Change /admin route to /admin-panel (#1) --- internal/web/admin.go | 8 ++++---- internal/web/run.go | 2 +- internal/web/util.go | 2 +- templates/base/admin_header.html | 6 +++--- templates/base/base_header.html | 4 ++-- templates/pages/admin_gists.html | 2 +- templates/pages/admin_index.html | 4 ++-- templates/pages/admin_users.html | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/web/admin.go b/internal/web/admin.go index c637511..3632252 100644 --- a/internal/web/admin.go +++ b/internal/web/admin.go @@ -101,7 +101,7 @@ func adminUserDelete(ctx echo.Context) error { } addFlash(ctx, "User has been deleted", "success") - return redirect(ctx, "/admin/users") + return redirect(ctx, "/admin-panel/users") } func adminGistDelete(ctx echo.Context) error { @@ -119,7 +119,7 @@ func adminGistDelete(ctx echo.Context) error { } addFlash(ctx, "Gist has been deleted", "success") - return redirect(ctx, "/admin/gists") + return redirect(ctx, "/admin-panel/gists") } func adminSyncReposFromFS(ctx echo.Context) error { @@ -148,7 +148,7 @@ func adminSyncReposFromFS(ctx echo.Context) error { } syncReposFromFS = false }() - return redirect(ctx, "/admin") + return redirect(ctx, "/admin-panel") } func adminSyncReposFromDB(ctx echo.Context) error { @@ -180,5 +180,5 @@ func adminSyncReposFromDB(ctx echo.Context) error { syncReposFromDB = false return }() - return redirect(ctx, "/admin") + return redirect(ctx, "/admin-panel") } diff --git a/internal/web/run.go b/internal/web/run.go index 1d66e64..5958179 100644 --- a/internal/web/run.go +++ b/internal/web/run.go @@ -173,7 +173,7 @@ func Start() { g1.POST("/settings/ssh-keys", sshKeysProcess, logged) g1.DELETE("/settings/ssh-keys/:id", sshKeysDelete, logged) - g2 := g1.Group("/admin") + g2 := g1.Group("/admin-panel") { g2.Use(adminPermission) g2.GET("", adminIndex) diff --git a/internal/web/util.go b/internal/web/util.go index d78a89d..714f959 100644 --- a/internal/web/util.go +++ b/internal/web/util.go @@ -148,7 +148,7 @@ func validateReservedKeywords(fl validator.FieldLevel) bool { name := fl.Field().String() restrictedNames := map[string]struct{}{} - for _, restrictedName := range []string{"assets", "register", "login", "logout", "config", "admin", "all"} { + for _, restrictedName := range []string{"assets", "register", "login", "logout", "config", "admin-panel", "all"} { restrictedNames[restrictedName] = struct{}{} } diff --git a/templates/base/admin_header.html b/templates/base/admin_header.html index d7be0b2..598a7cc 100644 --- a/templates/base/admin_header.html +++ b/templates/base/admin_header.html @@ -9,11 +9,11 @@
diff --git a/templates/base/base_header.html b/templates/base/base_header.html index 7abf7d5..47de0e8 100644 --- a/templates/base/base_header.html +++ b/templates/base/base_header.html @@ -53,7 +53,7 @@
{{ if .userLogged }} {{ if .userLogged.IsAdmin }} - + {{ end }} @@ -91,7 +91,7 @@ Settings {{ if .userLogged.IsAdmin }} - Admin + Admin {{ end }} {{ end }}
diff --git a/templates/pages/admin_gists.html b/templates/pages/admin_gists.html index 6750e04..9cfa5d5 100644 --- a/templates/pages/admin_gists.html +++ b/templates/pages/admin_gists.html @@ -28,7 +28,7 @@ {{ $gist.NbLikes }} {{ $gist.CreatedAt }} -
+ {{ $.csrfHtml }}
diff --git a/templates/pages/admin_index.html b/templates/pages/admin_index.html index 03fe60d..0ef7351 100644 --- a/templates/pages/admin_index.html +++ b/templates/pages/admin_index.html @@ -56,13 +56,13 @@ Actions
-
+ {{ .csrfHtml }}
-
+ {{ .csrfHtml }}