mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 12:54:53 -05:00
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 <mschaff@gmail.com> * 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 <mschaff@gmail.com> * 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 <mschaff@gmail.com> * 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 <mschaff@gmail.com> * Removed superfluous conditional and correct whitespace. Signed-off-by: Mike Schaffer <mschaff@gmail.com> * Update app.ini Reverted new line. * Formatting. Signed-off-by: Mike Schaffer <mschaff@gmail.com>
This commit is contained in:
parent
c3b6383b3a
commit
7e6c198f21
3 changed files with 7 additions and 4 deletions
2
conf/app.ini
vendored
2
conf/app.ini
vendored
|
@ -164,7 +164,7 @@ STATIC_ROOT_PATH =
|
||||||
APP_DATA_PATH = data
|
APP_DATA_PATH = data
|
||||||
; Application level GZIP support
|
; Application level GZIP support
|
||||||
ENABLE_GZIP = false
|
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
|
LANDING_PAGE = home
|
||||||
; Enables git-lfs support. true or false, default is false.
|
; Enables git-lfs support. true or false, default is false.
|
||||||
LFS_START_SERVER = false
|
LFS_START_SERVER = false
|
||||||
|
|
|
@ -56,8 +56,9 @@ type LandingPage string
|
||||||
|
|
||||||
// enumerates all the landing page types
|
// enumerates all the landing page types
|
||||||
const (
|
const (
|
||||||
LandingPageHome LandingPage = "/"
|
LandingPageHome LandingPage = "/"
|
||||||
LandingPageExplore LandingPage = "/explore"
|
LandingPageExplore LandingPage = "/explore"
|
||||||
|
LandingPageOrganizations LandingPage = "/explore/organizations"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MarkupParser defines the external parser configured in ini
|
// MarkupParser defines the external parser configured in ini
|
||||||
|
@ -737,6 +738,8 @@ func NewContext() {
|
||||||
switch sec.Key("LANDING_PAGE").MustString("home") {
|
switch sec.Key("LANDING_PAGE").MustString("home") {
|
||||||
case "explore":
|
case "explore":
|
||||||
LandingPageURL = LandingPageExplore
|
LandingPageURL = LandingPageExplore
|
||||||
|
case "organizations":
|
||||||
|
LandingPageURL = LandingPageOrganizations
|
||||||
default:
|
default:
|
||||||
LandingPageURL = LandingPageHome
|
LandingPageURL = LandingPageHome
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ func checkAutoLogin(ctx *context.Context) bool {
|
||||||
ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL)
|
ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL)
|
||||||
ctx.Redirect(redirectTo)
|
ctx.Redirect(redirectTo)
|
||||||
} else {
|
} else {
|
||||||
ctx.Redirect(setting.AppSubURL + "/")
|
ctx.Redirect(setting.AppSubURL + string(setting.LandingPageURL))
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue