From aedb05080c384f913183dcc00679b2003a7d10f0 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 27 Jun 2019 16:38:24 -0400 Subject: [PATCH] Support ?landing=1 to always show landing page This supports admins previewing changes to the landing page. Ref T565 --- app.go | 23 +++++++++++++++-------- pages/landing.tmpl | 8 ++++---- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/app.go b/app.go index 7b149cc..61db4e1 100644 --- a/app.go +++ b/app.go @@ -186,21 +186,28 @@ func handleViewHome(app *App, w http.ResponseWriter, r *http.Request) error { } // Multi-user instance - u := getUserSession(app, r) - if u != nil { - // User is logged in, so show the Pad - return handleViewPad(app, w, r) - } + forceLanding := r.FormValue("landing") == "1" + if !forceLanding { + // Show correct page based on user auth status and configured landing path + u := getUserSession(app, r) + if u != nil { + // User is logged in, so show the Pad + return handleViewPad(app, w, r) + } - if land := app.cfg.App.LandingPath(); land != "/" { - return impart.HTTPError{http.StatusFound, land} + if land := app.cfg.App.LandingPath(); land != "/" { + return impart.HTTPError{http.StatusFound, land} + } } p := struct { page.StaticPage Flashes []template.HTML + + ForcedLanding bool }{ - StaticPage: pageForReq(app, r), + StaticPage: pageForReq(app, r), + ForcedLanding: forceLanding, } // Get error messages diff --git a/pages/landing.tmpl b/pages/landing.tmpl index 5710933..fc4be05 100644 --- a/pages/landing.tmpl +++ b/pages/landing.tmpl @@ -76,20 +76,20 @@ form dd {
- +