Skip to content

Commit 7e6c198

Browse files
schaffman5lunny
authored andcommitted
Apply LANDING_PAGE config options for logged in users (#2894)
* Extended LANDINGPAGE config variable to logged in users and added switch for 'organizations' in addition to 'home' and 'explore'. * Updated comments. Signed-off-by: Mike Schaffer <[email protected]> * Extended LANDINGPAGE config variable to trigger when user logs in and added switch for 'organizations' in addition to 'home' and 'explore'. Signed-off-by: Mike Schaffer <[email protected]> * Extended LANDINGPAGE config variable to logged in users and added switch for 'organizations' in addition to 'home' and 'explore'. * Updated comments. Signed-off-by: Mike Schaffer <[email protected]> * Extended LANDINGPAGE config variable to trigger when user logs in and added switch for 'organizations' in addition to 'home' and 'explore'. Signed-off-by: Mike Schaffer <[email protected]> * Removed superfluous conditional and correct whitespace. Signed-off-by: Mike Schaffer <[email protected]> * Update app.ini Reverted new line. * Formatting. Signed-off-by: Mike Schaffer <[email protected]>
1 parent c3b6383 commit 7e6c198

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

conf/app.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ STATIC_ROOT_PATH =
164164
APP_DATA_PATH = data
165165
; Application level GZIP support
166166
ENABLE_GZIP = false
167-
; Landing page for non-logged users, can be "home" or "explore"
167+
; Landing page, can be "home", "explore", or "organizations"
168168
LANDING_PAGE = home
169169
; Enables git-lfs support. true or false, default is false.
170170
LFS_START_SERVER = false

modules/setting/setting.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ type LandingPage string
5656

5757
// enumerates all the landing page types
5858
const (
59-
LandingPageHome LandingPage = "/"
60-
LandingPageExplore LandingPage = "/explore"
59+
LandingPageHome LandingPage = "/"
60+
LandingPageExplore LandingPage = "/explore"
61+
LandingPageOrganizations LandingPage = "/explore/organizations"
6162
)
6263

6364
// MarkupParser defines the external parser configured in ini
@@ -737,6 +738,8 @@ func NewContext() {
737738
switch sec.Key("LANDING_PAGE").MustString("home") {
738739
case "explore":
739740
LandingPageURL = LandingPageExplore
741+
case "organizations":
742+
LandingPageURL = LandingPageOrganizations
740743
default:
741744
LandingPageURL = LandingPageHome
742745
}

routers/user/auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func checkAutoLogin(ctx *context.Context) bool {
9797
ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL)
9898
ctx.Redirect(redirectTo)
9999
} else {
100-
ctx.Redirect(setting.AppSubURL + "/")
100+
ctx.Redirect(setting.AppSubURL + string(setting.LandingPageURL))
101101
}
102102
return true
103103
}

0 commit comments

Comments
 (0)