summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEarl Warren <earl-warren@noreply.codeberg.org>2024-08-28 12:31:23 +0200
committerEarl Warren <earl-warren@noreply.codeberg.org>2024-08-28 12:31:23 +0200
commit949e415fd3c90f771c34195312ae74735f760add (patch)
treebbebc971f17cda000e0a595c88a183b0aefcdd83
parentMerge pull request '[v8.0/forgejo] [SEC] Ensure propagation of API scopes for... (diff)
parentchore(release-notes): weekly cherry-pick week 2024-35-v8.0 (diff)
downloadforgejo-8.0.2.tar.xz
forgejo-8.0.2.zip
Merge pull request '[gitea] week 2024-35-v8.0 cherry pick (gitea/main -> v8.0/forgejo)' (#5112) from earl-warren/wcp/2024-35-v8.0 into v8.0/forgejov8.0.2
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5112 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
-rw-r--r--modules/migration/pullrequest.go6
-rw-r--r--release-notes/5112.md1
-rw-r--r--routers/web/auth/linkaccount.go3
-rw-r--r--routers/web/auth/openid.go1
4 files changed, 8 insertions, 3 deletions
diff --git a/modules/migration/pullrequest.go b/modules/migration/pullrequest.go
index 4e7500f0d6..1435991bd2 100644
--- a/modules/migration/pullrequest.go
+++ b/modules/migration/pullrequest.go
@@ -45,7 +45,7 @@ func (p *PullRequest) GetContext() DownloaderContext { return p.Context }
// IsForkPullRequest returns true if the pull request from a forked repository but not the same repository
func (p *PullRequest) IsForkPullRequest() bool {
- return p.Head.RepoPath() != p.Base.RepoPath()
+ return p.Head.RepoFullName() != p.Base.RepoFullName()
}
// GetGitRefName returns pull request relative path to head
@@ -62,8 +62,8 @@ type PullRequestBranch struct {
OwnerName string `yaml:"owner_name"`
}
-// RepoPath returns pull request repo path
-func (p PullRequestBranch) RepoPath() string {
+// RepoFullName returns pull request repo full name
+func (p PullRequestBranch) RepoFullName() string {
return fmt.Sprintf("%s/%s", p.OwnerName, p.RepoName)
}
diff --git a/release-notes/5112.md b/release-notes/5112.md
new file mode 100644
index 0000000000..76647d967e
--- /dev/null
+++ b/release-notes/5112.md
@@ -0,0 +1 @@
+fix: [Add CfTurnstileSitekey context data to all captcha templates](https://codeberg.org/forgejo/forgejo/commit/bf07064e40472daa22063d0ac1fb3653008497eb).
diff --git a/routers/web/auth/linkaccount.go b/routers/web/auth/linkaccount.go
index f744a57a43..9b0141c14e 100644
--- a/routers/web/auth/linkaccount.go
+++ b/routers/web/auth/linkaccount.go
@@ -40,6 +40,7 @@ func LinkAccount(ctx *context.Context) {
ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
+ ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
ctx.Data["AllowOnlyInternalRegistration"] = setting.Service.AllowOnlyInternalRegistration
ctx.Data["ShowRegistrationButton"] = false
@@ -128,6 +129,7 @@ func LinkAccountPostSignIn(ctx *context.Context) {
ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
+ ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
ctx.Data["ShowRegistrationButton"] = false
@@ -215,6 +217,7 @@ func LinkAccountPostRegister(ctx *context.Context) {
ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
+ ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
ctx.Data["ShowRegistrationButton"] = false
diff --git a/routers/web/auth/openid.go b/routers/web/auth/openid.go
index 2143b8096a..83268faacb 100644
--- a/routers/web/auth/openid.go
+++ b/routers/web/auth/openid.go
@@ -307,6 +307,7 @@ func RegisterOpenID(ctx *context.Context) {
ctx.Data["RecaptchaURL"] = setting.Service.RecaptchaURL
ctx.Data["McaptchaSitekey"] = setting.Service.McaptchaSitekey
ctx.Data["McaptchaURL"] = setting.Service.McaptchaURL
+ ctx.Data["CfTurnstileSitekey"] = setting.Service.CfTurnstileSitekey
ctx.Data["OpenID"] = oid
userName, _ := ctx.Session.Get("openid_determined_username").(string)
if userName != "" {