Skip to content

Commit

Permalink
Apply LANDING_PAGE config options for logged in users (go-gitea#2894)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
schaffman5 authored and lunny committed Nov 20, 2017
1 parent c3b6383 commit 7e6c198
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion conf/app.ini
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ STATIC_ROOT_PATH =
APP_DATA_PATH = data
; Application level GZIP support
ENABLE_GZIP = false
; Landing page for non-logged users, can be "home" or "explore"
; Landing page, can be "home", "explore", or "organizations"
LANDING_PAGE = home
; Enables git-lfs support. true or false, default is false.
LFS_START_SERVER = false
Expand Down
7 changes: 5 additions & 2 deletions modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ type LandingPage string

// enumerates all the landing page types
const (
LandingPageHome LandingPage = "/"
LandingPageExplore LandingPage = "/explore"
LandingPageHome LandingPage = "/"
LandingPageExplore LandingPage = "/explore"
LandingPageOrganizations LandingPage = "/explore/organizations"
)

// MarkupParser defines the external parser configured in ini
Expand Down Expand Up @@ -737,6 +738,8 @@ func NewContext() {
switch sec.Key("LANDING_PAGE").MustString("home") {
case "explore":
LandingPageURL = LandingPageExplore
case "organizations":
LandingPageURL = LandingPageOrganizations
default:
LandingPageURL = LandingPageHome
}
Expand Down
2 changes: 1 addition & 1 deletion routers/user/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func checkAutoLogin(ctx *context.Context) bool {
ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL)
ctx.Redirect(redirectTo)
} else {
ctx.Redirect(setting.AppSubURL + "/")
ctx.Redirect(setting.AppSubURL + string(setting.LandingPageURL))
}
return true
}
Expand Down

0 comments on commit 7e6c198

Please sign in to comment.