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/config/config.go b/config/config.go index 40dbd4d..520dd59 100644 --- a/config/config.go +++ b/config/config.go @@ -193,6 +193,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 6a75d13..94087f3 100644 --- a/pages/login.tmpl +++ b/pages/login.tmpl @@ -72,7 +72,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}}