From 98ed4fb3842f8d6b515a9fa6fa4d4e0927ec1922 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Sun, 26 Sep 2021 23:42:57 +0530 Subject: [PATCH] Add a landing login page and a logout option. BasicAuth without an explicit landing page or a logout option has sometimes been confusing to users. This commit adds a static landing page on / with a login link and a logout option in the admin that "logs out" BasicAuth session by posting invalid credentials to the server to obtain a 401. --- cmd/handlers.go | 4 ++-- frontend/src/App.vue | 20 +++++++++++++++++++- frontend/src/api/index.js | 6 +++++- frontend/src/assets/style.scss | 4 ---- frontend/src/constants.js | 3 +++ i18n/cs-cz.json | 4 +++- i18n/de.json | 4 +++- i18n/en.json | 4 +++- i18n/es.json | 4 +++- i18n/fr.json | 4 +++- i18n/it.json | 4 +++- i18n/ml.json | 4 +++- i18n/pl.json | 4 +++- i18n/pt-BR.json | 4 +++- i18n/pt.json | 4 +++- i18n/ro.json | 4 +++- i18n/ru.json | 4 +++- i18n/tr.json | 4 +++- static/public/static/style.css | 5 +++++ 19 files changed, 73 insertions(+), 21 deletions(-) diff --git a/cmd/handlers.go b/cmd/handlers.go index 43693b68..d505deb9 100644 --- a/cmd/handlers.go +++ b/cmd/handlers.go @@ -51,8 +51,8 @@ func initHTTPHandlers(e *echo.Echo, app *App) { // Admin JS app views. // /admin/static/* file server is registered in initHTTPServer(). - g.GET("/", func(c echo.Context) error { - return c.Redirect(http.StatusPermanentRedirect, path.Join(adminRoot, "")) + e.GET("/", func(c echo.Context) error { + return c.Render(http.StatusOK, "home", publicTpl{Title: "listmonk"}) }) g.GET(path.Join(adminRoot, ""), handleAdminPage) g.GET(path.Join(adminRoot, "/*"), handleAdminPage) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 0feccf3c..ca2e24a2 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -10,7 +10,9 @@ @@ -134,6 +136,7 @@