From 7aef7069778cb6ea69112a6138334f9efd38ff07 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Wed, 12 Feb 2020 15:29:44 -0500 Subject: [PATCH 1/3] Fix Reader nav link on WFModesty + Private instance (that is, hide the footer nav link when logged out) --- templates/include/footer.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/include/footer.tmpl b/templates/include/footer.tmpl index 16434b9..0f258e7 100644 --- a/templates/include/footer.tmpl +++ b/templates/include/footer.tmpl @@ -6,7 +6,7 @@ {{.SiteName}} {{if not .SingleUser}} about - {{if .LocalTimeline}}reader{{end}} + {{if and .LocalTimeline .CanViewReader}}reader{{end}} {{if .Username}}writer's guide{{end}} privacy

powered by writefreely

From 151ec71163aec86b3f7d24c12cb2f150a9aa6c7f Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Mon, 2 Mar 2020 16:32:04 -0600 Subject: [PATCH 2/3] Land on login form for private instances --- app.go | 4 ++++ templates/base.tmpl | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app.go b/app.go index dd05c95..048c8d0 100644 --- a/app.go +++ b/app.go @@ -221,6 +221,10 @@ func handleViewHome(app *App, w http.ResponseWriter, r *http.Request) error { return handleViewPad(app, w, r) } + if app.cfg.App.Private { + return viewLogin(app, w, r) + } + if land := app.cfg.App.LandingPath(); land != "/" { return impart.HTTPError{http.StatusFound, land} } diff --git a/templates/base.tmpl b/templates/base.tmpl index 3826917..ef44121 100644 --- a/templates/base.tmpl +++ b/templates/base.tmpl @@ -48,7 +48,7 @@ {{ end }} {{if and (and .LocalTimeline .CanViewReader) (not .Chorus)}}Reader{{end}} {{if and (and (and .Chorus .OpenRegistration) (not .Username)) (or (not .Private) (ne .Landing ""))}}Sign up{{end}} - {{if not .Username}}Log in{{else if .SimpleNav}}Log out{{end}} + {{if and (not .Username) (not .Private)}}Log in{{else if .SimpleNav}}Log out{{end}} {{ end }} {{if .Chorus}}{{if .Username}}
From 2db6c33a410202eb441352dba53632db9540fdc9 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Mon, 2 Mar 2020 16:34:44 -0600 Subject: [PATCH 3/3] Consolidate /signup page link logic This moves logic for determining whether or not to show a "Sign up" page on /signup (i.e. because the `/` route shows another, non-signup page) into the AppCfg.SignupPath() method. It also changes various signup links to use this value. --- config/config.go | 10 ++++++++++ pages/login.tmpl | 2 +- templates/base.tmpl | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index 78892bf..a616401 100644 --- a/config/config.go +++ b/config/config.go @@ -183,6 +183,16 @@ func (ac *AppCfg) LandingPath() string { return ac.Landing } +func (ac AppCfg) SignupPath() string { + if !ac.OpenRegistration { + return "" + } + if ac.Chorus || ac.Private || (ac.Landing != "" && ac.Landing != "/") { + return "/signup" + } + return "/" +} + // Load reads the given configuration file, then parses and returns it as a Config. func Load(fname string) (*Config, error) { if fname == "" { diff --git a/pages/login.tmpl b/pages/login.tmpl index 345b171..79875c6 100644 --- a/pages/login.tmpl +++ b/pages/login.tmpl @@ -65,7 +65,7 @@ hr.short { - {{if and (not .SingleUser) .OpenRegistration}}

{{if .Message}}{{.Message}}{{else}}No account yet? Sign up to start a blog.{{end}}

{{end}} + {{if and (not .SingleUser) .OpenRegistration}}

{{if .Message}}{{.Message}}{{else}}No account yet? Sign up to start a blog.{{end}}

{{end}}