diff options
author | Timon Engelke <timonegk@users.noreply.github.com> | 2020-01-06 17:50:44 +0100 |
---|---|---|
committer | Antoine GIRARD <sapk@users.noreply.github.com> | 2020-01-06 17:50:44 +0100 |
commit | abc0f53539e3b96dd73c80615fc5409758cc028f (patch) | |
tree | 04e3659ede07cd92836f212dfe21cdf421d7a173 | |
parent | bcac7cb9342e17bdb80028f342fb911dcb854c25 (diff) | |
download | gitea-abc0f53539e3b96dd73c80615fc5409758cc028f.tar.gz gitea-abc0f53539e3b96dd73c80615fc5409758cc028f.zip |
Add a /user/login landing page option (#9622)
* Add a /user/login landing page option
* Add test case for login landing page
-rw-r--r-- | custom/conf/app.ini.sample | 3 | ||||
-rw-r--r-- | docs/content/doc/advanced/config-cheat-sheet.en-us.md | 2 | ||||
-rw-r--r-- | integrations/setting_test.go | 5 | ||||
-rw-r--r-- | modules/setting/setting.go | 3 |
4 files changed, 11 insertions, 2 deletions
diff --git a/custom/conf/app.ini.sample b/custom/conf/app.ini.sample index b082bc40f1..8b72ead3d6 100644 --- a/custom/conf/app.ini.sample +++ b/custom/conf/app.ini.sample @@ -290,7 +290,8 @@ ENABLE_GZIP = false ENABLE_PPROF = false ; PPROF_DATA_PATH, use an absolute path when you start gitea as service PPROF_DATA_PATH = data/tmp/pprof -; Landing page, can be "home", "explore", or "organizations" +; Landing page, can be "home", "explore", "organizations" or "login" +; The "login" choice is not a security measure but just a UI flow change, use REQUIRE_SIGNIN_VIEW to force users to log in. LANDING_PAGE = home ; Enables git-lfs support. true or false, default is false. LFS_START_SERVER = false diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 08aca1edf2..691c543a6c 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -186,7 +186,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. - `STATIC_ROOT_PATH`: **./**: Upper level of template and static files path. - `STATIC_CACHE_TIME`: **6h**: Web browser cache time for static resources on `custom/`, `public/` and all uploaded avatars. - `ENABLE_GZIP`: **false**: Enables application-level GZIP support. -- `LANDING_PAGE`: **home**: Landing page for unauthenticated users \[home, explore\]. +- `LANDING_PAGE`: **home**: Landing page for unauthenticated users \[home, explore, organizations, login\]. - `LFS_START_SERVER`: **false**: Enables git-lfs support. - `LFS_CONTENT_PATH`: **./data/lfs**: Where to store LFS files. - `LFS_JWT_SECRET`: **\<empty\>**: LFS authentication secret, change this a unique string. diff --git a/integrations/setting_test.go b/integrations/setting_test.go index 518a3b7c6f..eb495acb24 100644 --- a/integrations/setting_test.go +++ b/integrations/setting_test.go @@ -99,5 +99,10 @@ func TestSettingLandingPage(t *testing.T) { resp = MakeRequest(t, req, http.StatusFound) assert.Equal(t, "/explore/organizations", resp.Header().Get("Location")) + setting.LandingPageURL = setting.LandingPageLogin + req = NewRequest(t, "GET", "/") + resp = MakeRequest(t, req, http.StatusFound) + assert.Equal(t, "/user/login", resp.Header().Get("Location")) + setting.LandingPageURL = landingPage } diff --git a/modules/setting/setting.go b/modules/setting/setting.go index dbf43f31ee..2a5e37b41b 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -54,6 +54,7 @@ const ( LandingPageHome LandingPage = "/" LandingPageExplore LandingPage = "/explore" LandingPageOrganizations LandingPage = "/explore/organizations" + LandingPageLogin LandingPage = "/user/login" ) // enumerates all the types of captchas @@ -648,6 +649,8 @@ func NewContext() { LandingPageURL = LandingPageExplore case "organizations": LandingPageURL = LandingPageOrganizations + case "login": + LandingPageURL = LandingPageLogin default: LandingPageURL = LandingPageHome } |