Skip to content

Commit abc0f53

Browse files
timonegksapk
authored andcommitted
Add a /user/login landing page option (#9622)
* Add a /user/login landing page option * Add test case for login landing page
1 parent bcac7cb commit abc0f53

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

custom/conf/app.ini.sample

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ ENABLE_GZIP = false
290290
ENABLE_PPROF = false
291291
; PPROF_DATA_PATH, use an absolute path when you start gitea as service
292292
PPROF_DATA_PATH = data/tmp/pprof
293-
; Landing page, can be "home", "explore", or "organizations"
293+
; Landing page, can be "home", "explore", "organizations" or "login"
294+
; The "login" choice is not a security measure but just a UI flow change, use REQUIRE_SIGNIN_VIEW to force users to log in.
294295
LANDING_PAGE = home
295296
; Enables git-lfs support. true or false, default is false.
296297
LFS_START_SERVER = false

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
186186
- `STATIC_ROOT_PATH`: **./**: Upper level of template and static files path.
187187
- `STATIC_CACHE_TIME`: **6h**: Web browser cache time for static resources on `custom/`, `public/` and all uploaded avatars.
188188
- `ENABLE_GZIP`: **false**: Enables application-level GZIP support.
189-
- `LANDING_PAGE`: **home**: Landing page for unauthenticated users \[home, explore\].
189+
- `LANDING_PAGE`: **home**: Landing page for unauthenticated users \[home, explore, organizations, login\].
190190
- `LFS_START_SERVER`: **false**: Enables git-lfs support.
191191
- `LFS_CONTENT_PATH`: **./data/lfs**: Where to store LFS files.
192192
- `LFS_JWT_SECRET`: **\<empty\>**: LFS authentication secret, change this a unique string.

integrations/setting_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,10 @@ func TestSettingLandingPage(t *testing.T) {
9999
resp = MakeRequest(t, req, http.StatusFound)
100100
assert.Equal(t, "/explore/organizations", resp.Header().Get("Location"))
101101

102+
setting.LandingPageURL = setting.LandingPageLogin
103+
req = NewRequest(t, "GET", "/")
104+
resp = MakeRequest(t, req, http.StatusFound)
105+
assert.Equal(t, "/user/login", resp.Header().Get("Location"))
106+
102107
setting.LandingPageURL = landingPage
103108
}

modules/setting/setting.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const (
5454
LandingPageHome LandingPage = "/"
5555
LandingPageExplore LandingPage = "/explore"
5656
LandingPageOrganizations LandingPage = "/explore/organizations"
57+
LandingPageLogin LandingPage = "/user/login"
5758
)
5859

5960
// enumerates all the types of captchas
@@ -648,6 +649,8 @@ func NewContext() {
648649
LandingPageURL = LandingPageExplore
649650
case "organizations":
650651
LandingPageURL = LandingPageOrganizations
652+
case "login":
653+
LandingPageURL = LandingPageLogin
651654
default:
652655
LandingPageURL = LandingPageHome
653656
}

0 commit comments

Comments
 (0)