summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/middleware/auth.go6
-rw-r--r--modules/setting/setting.go15
2 files changed, 21 insertions, 0 deletions
diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go
index fc8e94bbd0..94bb1c14a4 100644
--- a/modules/middleware/auth.go
+++ b/modules/middleware/auth.go
@@ -29,6 +29,12 @@ func Toggle(options *ToggleOptions) macaron.Handler {
return
}
+ // Checking non-logged users landing page.
+ if !ctx.IsSigned && ctx.Req.RequestURI == "/" && setting.LandingPageUrl != setting.LANDING_PAGE_HOME {
+ ctx.Redirect(string(setting.LandingPageUrl))
+ return
+ }
+
// Redirect to dashboard if user tries to visit any non-login page.
if options.SignOutRequire && ctx.IsSigned && ctx.Req.RequestURI != "/" {
ctx.Redirect(setting.AppSubUrl + "/")
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index cf34c2edc6..a775847c1f 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -31,6 +31,13 @@ const (
FCGI Scheme = "fcgi"
)
+type LandingPage string
+
+const (
+ LANDING_PAGE_HOME LandingPage = "/"
+ LANDING_PAGE_EXPLORE LandingPage = "/explore"
+)
+
var (
// App settings.
AppVer string
@@ -48,6 +55,7 @@ var (
CertFile, KeyFile string
StaticRootPath string
EnableGzip bool
+ LandingPageUrl LandingPage
// Security settings.
InstallLock bool
@@ -197,6 +205,13 @@ func NewConfigContext() {
LogRootPath = Cfg.MustValue("log", "ROOT_PATH", path.Join(workDir, "log"))
EnableGzip = Cfg.MustBool("server", "ENABLE_GZIP")
+ switch Cfg.MustValue("server", "LANDING_PAGE", "home") {
+ case "explore":
+ LandingPageUrl = LANDING_PAGE_EXPLORE
+ default:
+ LandingPageUrl = LANDING_PAGE_HOME
+ }
+
InstallLock = Cfg.MustBool("security", "INSTALL_LOCK")
SecretKey = Cfg.MustValue("security", "SECRET_KEY")
LogInRememberDays = Cfg.MustInt("security", "LOGIN_REMEMBER_DAYS")