From c58d282f3df0743db3b6f221f4303ed2bc818fb3 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 14 Feb 2025 11:29:53 +0000 Subject: [PATCH 1/5] Update dependency webpack to v5.98.0 (forgejo) (#6927) Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6927 Reviewed-by: Michael Kriese Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- package-lock.json | 64 +++++++---------------------------------------- package.json | 2 +- 2 files changed, 10 insertions(+), 56 deletions(-) diff --git a/package-lock.json b/package-lock.json index bcd6c94289..d7a4141c19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,7 @@ "vue-chartjs": "5.3.1", "vue-loader": "17.4.2", "vue3-calendar-heatmap": "2.0.5", - "webpack": "5.97.1", + "webpack": "5.98.0", "webpack-cli": "6.0.1", "wrap-ansi": "9.0.0" }, @@ -9167,6 +9167,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, "license": "MIT" }, "node_modules/fast-levenshtein": { @@ -13599,6 +13600,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -16191,6 +16193,7 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "punycode": "^2.1.0" @@ -16709,9 +16712,9 @@ } }, "node_modules/webpack": { - "version": "5.97.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.97.1.tgz", - "integrity": "sha512-EksG6gFY3L1eFMROS/7Wzgrii5mBAFe4rIr3r2BTfo7bcc+DWwFZ4OJ/miOuHJO/A85HwyI4eQ0F6IKXesO7Fg==", + "version": "5.98.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.98.0.tgz", + "integrity": "sha512-UFynvx+gM44Gv9qFgj0acCQK2VE1CtdfwFdimkapco3hlPCJ/zeq73n2yVKimVbtm+TnApIugGhLJnkU6gjYXA==", "license": "MIT", "dependencies": { "@types/eslint-scope": "^3.7.7", @@ -16732,9 +16735,9 @@ "loader-runner": "^4.2.0", "mime-types": "^2.1.27", "neo-async": "^2.6.2", - "schema-utils": "^3.2.0", + "schema-utils": "^4.3.0", "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.10", + "terser-webpack-plugin": "^5.3.11", "watchpack": "^2.4.1", "webpack-sources": "^3.2.3" }, @@ -16835,31 +16838,6 @@ "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", "license": "MIT" }, - "node_modules/webpack/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/webpack/node_modules/ajv-keywords": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", - "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "license": "MIT", - "peerDependencies": { - "ajv": "^6.9.1" - } - }, "node_modules/webpack/node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -16882,30 +16860,6 @@ "node": ">=4.0" } }, - "node_modules/webpack/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "license": "MIT" - }, - "node_modules/webpack/node_modules/schema-utils": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", - "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, "node_modules/webpack/node_modules/webpack-sources": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", diff --git a/package.json b/package.json index 6d6e35dade..d3a614cb29 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "vue-chartjs": "5.3.1", "vue-loader": "17.4.2", "vue3-calendar-heatmap": "2.0.5", - "webpack": "5.97.1", + "webpack": "5.98.0", "webpack-cli": "6.0.1", "wrap-ansi": "9.0.0" }, From b1a7db7e2877a2803cae140f27d28251da25970b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Ri=C3=9Fe?= Date: Fri, 14 Feb 2025 12:45:15 +0000 Subject: [PATCH 2/5] fix: show internal login prompt for account linking (#6920) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #6878. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6920 Reviewed-by: Gusted Co-authored-by: Matthias Riße Co-committed-by: Matthias Riße --- routers/web/auth/linkaccount.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routers/web/auth/linkaccount.go b/routers/web/auth/linkaccount.go index 8dce0a30a4..e6c9089380 100644 --- a/routers/web/auth/linkaccount.go +++ b/routers/web/auth/linkaccount.go @@ -44,6 +44,7 @@ func LinkAccount(ctx *context.Context) { ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration ctx.Data["AllowOnlyInternalRegistration"] = setting.Service.AllowOnlyInternalRegistration ctx.Data["ShowRegistrationButton"] = false + ctx.Data["EnableInternalSignIn"] = true // use this to set the right link into the signIn and signUp templates in the link_account template ctx.Data["SignInLink"] = setting.AppSubURL + "/user/link_account_signin" @@ -122,6 +123,7 @@ func LinkAccountPostSignIn(ctx *context.Context) { ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration ctx.Data["ShowRegistrationButton"] = false + ctx.Data["EnableInternalSignIn"] = true // use this to set the right link into the signIn and signUp templates in the link_account template ctx.Data["SignInLink"] = setting.AppSubURL + "/user/link_account_signin" From ef2fbc6093adf918a986ea139e42926c55dca815 Mon Sep 17 00:00:00 2001 From: davrot Date: Fri, 14 Feb 2025 12:54:18 +0000 Subject: [PATCH 3/5] fix: disable forgotten password for external signin only (#6680) - Make it such that `[service].ENABLE_INTERNAL_SIGNIN = false` disables the forgotten password prompt on the login page. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6680 Reviewed-by: Gusted Co-authored-by: davrot Co-committed-by: davrot --- routers/web/auth/auth.go | 3 ++ templates/user/auth/signin_inner.tmpl | 3 ++ .../disable_forgotten_password_test.go | 39 +++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 tests/integration/disable_forgotten_password_test.go diff --git a/routers/web/auth/auth.go b/routers/web/auth/auth.go index ca8f06bdb1..92305ad26a 100644 --- a/routers/web/auth/auth.go +++ b/routers/web/auth/auth.go @@ -171,6 +171,8 @@ func SignIn(ctx *context.Context) { context.SetCaptchaData(ctx) } + ctx.Data["DisablePassword"] = !setting.Service.EnableInternalSignIn + ctx.HTML(http.StatusOK, tplSignIn) } @@ -190,6 +192,7 @@ func SignInPost(ctx *context.Context) { ctx.Data["PageIsLogin"] = true ctx.Data["EnableSSPI"] = auth.IsSSPIEnabled(ctx) ctx.Data["EnableInternalSignIn"] = setting.Service.EnableInternalSignIn + ctx.Data["DisablePassword"] = !setting.Service.EnableInternalSignIn // Permission denied if EnableInternalSignIn is false if !setting.Service.EnableInternalSignIn { diff --git a/templates/user/auth/signin_inner.tmpl b/templates/user/auth/signin_inner.tmpl index ddef34f35d..4abb4646d1 100644 --- a/templates/user/auth/signin_inner.tmpl +++ b/templates/user/auth/signin_inner.tmpl @@ -50,6 +50,7 @@ +{{if not .DisablePassword}}
{{template "user/auth/webauthn_error" .}} @@ -65,3 +66,5 @@
+{{end}} + diff --git a/tests/integration/disable_forgotten_password_test.go b/tests/integration/disable_forgotten_password_test.go new file mode 100644 index 0000000000..8a50c8d409 --- /dev/null +++ b/tests/integration/disable_forgotten_password_test.go @@ -0,0 +1,39 @@ +package integration + +import ( + "net/http" + "testing" + + "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/test" + "code.gitea.io/gitea/tests" +) + +func TestDisableForgottenPasswordFalse(t *testing.T) { + defer tests.PrepareTestEnv(t)() + defer test.MockVariableValue(&setting.Service.EnableInternalSignIn, true)() + + req := NewRequest(t, "GET", "/user/login/") + resp := MakeRequest(t, req, http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) + htmlDoc.AssertElement(t, "a[href='/user/forgot_password']", true) +} + +func TestDisableForgottenPasswordTrue(t *testing.T) { + defer tests.PrepareTestEnv(t)() + defer test.MockVariableValue(&setting.Service.EnableInternalSignIn, false)() + + req := NewRequest(t, "GET", "/user/login/") + resp := MakeRequest(t, req, http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) + htmlDoc.AssertElement(t, "a[href='/user/forgot_password']", false) +} + +func TestDisableForgottenPasswordDefault(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + req := NewRequest(t, "GET", "/user/login/") + resp := MakeRequest(t, req, http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) + htmlDoc.AssertElement(t, "a[href='/user/forgot_password']", true) +} From df232e1a8fb6a0274e1bdff8cb37226986881030 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 14 Feb 2025 12:57:09 +0000 Subject: [PATCH 4/5] Update module github.com/buildkite/terminal-to-html/v3 to v3.16.5 (forgejo) (#6916) Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6916 Reviewed-by: Gusted Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0746c4ab42..c0a97b21fd 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/alecthomas/chroma/v2 v2.15.0 github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb github.com/blevesearch/bleve/v2 v2.4.4 - github.com/buildkite/terminal-to-html/v3 v3.16.4 + github.com/buildkite/terminal-to-html/v3 v3.16.5 github.com/caddyserver/certmagic v0.21.7 github.com/chi-middleware/proxy v1.1.1 github.com/djherbis/buffer v1.2.0 diff --git a/go.sum b/go.sum index 1df46c9df9..b2d734d636 100644 --- a/go.sum +++ b/go.sum @@ -768,8 +768,8 @@ github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= -github.com/buildkite/terminal-to-html/v3 v3.16.4 h1:QFYO8IGvRnp7tGgiQb8g9uFU8kY9wOzxsFFx17+yy6Q= -github.com/buildkite/terminal-to-html/v3 v3.16.4/go.mod h1:r/J7cC9c3EzBzP3/wDz0RJLPwv5PUAMp+KF2w+ntMc0= +github.com/buildkite/terminal-to-html/v3 v3.16.5 h1:s/8NElw/Yhm09jKdMq4nY31tjcFMgHukjLfPrqxApcQ= +github.com/buildkite/terminal-to-html/v3 v3.16.5/go.mod h1:PgzeBymbRFC8I2m46Sci3S18AbwonEgpaz3TGhD7EPs= github.com/caddyserver/certmagic v0.21.7 h1:66KJioPFJwttL43KYSWk7ErSmE6LfaJgCQuhm8Sg6fg= github.com/caddyserver/certmagic v0.21.7/go.mod h1:LCPG3WLxcnjVKl/xpjzM0gqh0knrKKKiO5WVttX2eEI= github.com/caddyserver/zerossl v0.1.3 h1:onS+pxp3M8HnHpN5MMbOMyNjmTheJyWRaZYwn+YTAyA= From 43cde371d2587b2742a7ada06371d5348d6b35bb Mon Sep 17 00:00:00 2001 From: davrot Date: Fri, 14 Feb 2025 23:54:11 +0000 Subject: [PATCH 5/5] =?UTF-8?q?Dateien=20nach=20=E2=80=9Etests/integration?= =?UTF-8?q?=E2=80=9C=20hochladen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/integration/landingpagedetails_test.go | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/integration/landingpagedetails_test.go diff --git a/tests/integration/landingpagedetails_test.go b/tests/integration/landingpagedetails_test.go new file mode 100644 index 0000000000..09760f3f49 --- /dev/null +++ b/tests/integration/landingpagedetails_test.go @@ -0,0 +1,39 @@ +package integration + +import ( + "net/http" + "testing" + + "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/test" + "code.gitea.io/gitea/tests" +) + +func TestLandingPageDetailsDefault(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + req := NewRequest(t, "GET", "/") + resp := MakeRequest(t, req, http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) + htmlDoc.AssertElement(t, "a[href='https://forgejo.org/download/#installation-from-binary']", true) +} + +func TestLandingPageDetailsTrue(t *testing.T) { + defer tests.PrepareTestEnv(t)() + defer test.MockVariableValue(&setting.LandingPageDetails, true)() + + req := NewRequest(t, "GET", "/") + resp := MakeRequest(t, req, http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) + htmlDoc.AssertElement(t, "a[href='https://forgejo.org/download/#installation-from-binary']", true) +} + +func TestLandingPageDetailsFalse(t *testing.T) { + defer tests.PrepareTestEnv(t)() + defer test.MockVariableValue(&setting.LandingPageDetails, false)() + + req := NewRequest(t, "GET", "/") + resp := MakeRequest(t, req, http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) + htmlDoc.AssertElement(t, "a[href='https://forgejo.org/download/#installation-from-binary']", false) +}