| @@ -46,6 +46,7 @@ type CreateRepoForm struct { | |||||
| Webhooks bool | Webhooks bool | ||||
| Avatar bool | Avatar bool | ||||
| Labels bool | Labels bool | ||||
| AutoAgree bool | |||||
| } | } | ||||
| // Validate validates the fields | // Validate validates the fields | ||||
| @@ -1179,6 +1179,7 @@ template.topics = Topics | |||||
| template.avatar = Avatar | template.avatar = Avatar | ||||
| template.issue_labels = Issue Labels | template.issue_labels = Issue Labels | ||||
| template.one_item = Must select at least one template item | 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.invalid = Must select a template repository | ||||
| template.repo_adress=Adress | template.repo_adress=Adress | ||||
| template.repo_path=path | template.repo_path=path | ||||
| @@ -1189,6 +1189,7 @@ template.topics=主题 | |||||
| template.avatar=头像 | template.avatar=头像 | ||||
| template.issue_labels=任务标签 | template.issue_labels=任务标签 | ||||
| template.one_item=必须至少选择一个模板项 | template.one_item=必须至少选择一个模板项 | ||||
| template.one_promise=创建项目需承诺使用协议! | |||||
| template.invalid=必须选择一个模板项目 | template.invalid=必须选择一个模板项目 | ||||
| template.repo_adress=项目地址 | template.repo_adress=项目地址 | ||||
| template.repo_path=项目地址 | template.repo_path=项目地址 | ||||
| @@ -6,7 +6,6 @@ | |||||
| package repo | package repo | ||||
| import ( | import ( | ||||
| "code.gitea.io/gitea/modules/validation" | |||||
| "fmt" | "fmt" | ||||
| "net/url" | "net/url" | ||||
| "os" | "os" | ||||
| @@ -15,6 +14,8 @@ import ( | |||||
| "strings" | "strings" | ||||
| "unicode/utf8" | "unicode/utf8" | ||||
| "code.gitea.io/gitea/modules/validation" | |||||
| "code.gitea.io/gitea/models" | "code.gitea.io/gitea/models" | ||||
| "code.gitea.io/gitea/modules/auth" | "code.gitea.io/gitea/modules/auth" | ||||
| "code.gitea.io/gitea/modules/base" | "code.gitea.io/gitea/modules/base" | ||||
| @@ -193,7 +194,10 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) { | |||||
| return | return | ||||
| } | } | ||||
| ctx.Data["ContextUser"] = ctxUser | ctx.Data["ContextUser"] = ctxUser | ||||
| if !form.AutoAgree { | |||||
| ctx.RenderWithErr(ctx.Tr("repo.template.one_promise"), tplCreate, form) | |||||
| return | |||||
| } | |||||
| if ctx.HasError() { | if ctx.HasError() { | ||||
| ctx.HTML(200, tplCreate) | ctx.HTML(200, tplCreate) | ||||
| return | return | ||||