diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index ab724e923..9ea5da879 100755 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -46,6 +46,7 @@ type CreateRepoForm struct { Webhooks bool Avatar bool Labels bool + AutoAgree bool } // Validate validates the fields diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 06ef92403..016aa4951 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1184,6 +1184,7 @@ template.topics = Topics template.avatar = Avatar template.issue_labels = Issue Labels template.one_item = Must select at least one template item +template.one_promise = Must agree to use the agreement! template.invalid = Must select a template repository template.repo_adress=Adress template.repo_path=path @@ -2258,7 +2259,8 @@ topic.done = Done topic.count_prompt = You can not select more than 25 topics topic.format_prompt = Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long. imagetopic.format_prompt = Topics can be up to 35 characters long. - +use_repo_agreement=I promise that the content of this warehouse does not violate any national laws and regulations. During the use of the warehouse, I will abide by the OpenI community management regulations and platform usage rules, and will not conduct malicious attacks, mining, or any other illegal or disruptive platform order. Information release and related behaviors. For more information please refer to +openi_use_agreement=OpenI Qizhi Community Platform Use Agreement. [org] org_name_holder = Organization Name org_full_name_holder = Organization Full Name diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 75d2fe7fb..440f6746a 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -1194,6 +1194,7 @@ template.topics=主题 template.avatar=头像 template.issue_labels=任务标签 template.one_item=必须至少选择一个模板项 +template.one_promise=创建项目需承诺使用协议! template.invalid=必须选择一个模板项目 template.repo_adress=项目地址 template.repo_path=项目地址 @@ -2268,7 +2269,8 @@ topic.done=保存 topic.count_prompt=您最多选择25个标签 topic.format_prompt=标签必须以中文、字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符 imagetopic.format_prompt=标签长度不得超过35个字符 - +use_repo_agreement=我承诺此仓内容不违反任何国家法律法规,仓库使用过程中遵守OpenI启智社区管理规定和平台使用规则,不进行恶意攻击、挖矿等任何违法或扰乱平台秩序的信息发布和相关行为。更多信息请参考 +openi_use_agreement=OpenI启智社区平台使用协议 [org] org_name_holder=组织名称 org_full_name_holder=组织全名 diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 70705dcf1..c0803ed06 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -6,7 +6,6 @@ package repo import ( - "code.gitea.io/gitea/modules/validation" "fmt" "net/url" "os" @@ -15,6 +14,8 @@ import ( "strings" "unicode/utf8" + "code.gitea.io/gitea/modules/validation" + "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/auth" "code.gitea.io/gitea/modules/base" @@ -193,7 +194,10 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) { return } ctx.Data["ContextUser"] = ctxUser - + if !form.AutoAgree { + ctx.RenderWithErr(ctx.Tr("repo.template.one_promise"), tplCreate, form) + return + } if ctx.HasError() { ctx.HTML(200, tplCreate) return diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index 4b34b8659..2e1dd51a6 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -15,11 +15,11 @@
{{if .IsForcedPrivate}} - - + + {{else}} - - + + {{end}}
{{.i18n.Tr "repo.visibility_description"}} @@ -42,33 +42,41 @@
- +
-
- +
+
- +
- +
- +
- +
@@ -83,7 +91,8 @@
@@ -98,7 +107,7 @@
{{.i18n.Tr "repo.repo_gitignore_helper"}}
@@ -111,7 +120,7 @@ @@ -124,24 +133,34 @@
{{.i18n.Tr "repo.readme_helper"}}
- +
- + +
+
+
+ + +
-
+
-{{template "base/footer" .}} +{{template "base/footer" .}} \ No newline at end of file