File tree Expand file tree Collapse file tree 3 files changed +26
-6
lines changed Expand file tree Collapse file tree 3 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -68,3 +68,25 @@ func TestSettingShowUserEmailProfile(t *testing.T) {
68
68
69
69
setting .UI .ShowUserEmail = showUserEmail
70
70
}
71
+
72
+ func TestSettingLandingPage (t * testing.T ) {
73
+ prepareTestEnv (t )
74
+
75
+ landingPage := setting .LandingPageURL
76
+
77
+ setting .LandingPageURL = setting .LandingPageHome
78
+ req := NewRequest (t , "GET" , "/" )
79
+ MakeRequest (t , req , http .StatusOK )
80
+
81
+ setting .LandingPageURL = setting .LandingPageExplore
82
+ req = NewRequest (t , "GET" , "/" )
83
+ resp := MakeRequest (t , req , http .StatusFound )
84
+ assert .Equal (t , "/explore" , resp .Header ().Get ("Location" ))
85
+
86
+ setting .LandingPageURL = setting .LandingPageOrganizations
87
+ req = NewRequest (t , "GET" , "/" )
88
+ resp = MakeRequest (t , req , http .StatusFound )
89
+ assert .Equal (t , "/explore/organizations" , resp .Header ().Get ("Location" ))
90
+
91
+ setting .LandingPageURL = landingPage
92
+ }
Original file line number Diff line number Diff line change @@ -37,12 +37,6 @@ func Toggle(options *ToggleOptions) macaron.Handler {
37
37
return
38
38
}
39
39
40
- // Check non-logged users landing page.
41
- if ! ctx .IsSigned && ctx .Req .RequestURI == "/" && setting .LandingPageURL != setting .LandingPageHome {
42
- ctx .Redirect (setting .AppSubURL + string (setting .LandingPageURL ))
43
- return
44
- }
45
-
46
40
// Redirect to dashboard if user tries to visit any non-login page.
47
41
if options .SignOutRequired && ctx .IsSigned && ctx .Req .RequestURI != "/" {
48
42
ctx .Redirect (setting .AppSubURL + "/" )
Original file line number Diff line number Diff line change @@ -42,6 +42,10 @@ func Home(ctx *context.Context) {
42
42
user .Dashboard (ctx )
43
43
}
44
44
return
45
+ // Check non-logged users landing page.
46
+ } else if setting .LandingPageURL != setting .LandingPageHome {
47
+ ctx .Redirect (setting .AppSubURL + string (setting .LandingPageURL ))
48
+ return
45
49
}
46
50
47
51
// Check auto-login.
You can’t perform that action at this time.
0 commit comments